WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 6 of 7] [OCAML] Fix 2 bit-twiddling bugs and an off-b

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 6 of 7] [OCAML] Fix 2 bit-twiddling bugs and an off-by-one
From: Jon Ludlam <jonathan.ludlam@xxxxxxxxxxxxx>
Date: Thu, 29 Sep 2011 22:17:28 +0100
Cc: jonathan.ludlam@xxxxxxxxxxxxx
Delivery-date: Thu, 29 Sep 2011 14:27:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1317331042@xxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1317331042@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
The bit bugs are in ocaml vcpu affinity calls, and the off-by-one
error is in the ocaml console ring code

Signed-off-by: Zheng Li <zheng.li@xxxxxxxxxxxxx>
Acked-by: Jon Ludlam <jonathan.ludlam@xxxxxxxxxxxxx>

diff -r 48d4f312d069 -r 05ac32c3956c tools/ocaml/libs/xc/xc_stubs.c
--- a/tools/ocaml/libs/xc/xc_stubs.c
+++ b/tools/ocaml/libs/xc/xc_stubs.c
@@ -430,7 +430,7 @@
 
        for (i=0; i<len; i++) {
                if (Bool_val(Field(cpumap, i)))
-                       c_cpumap[i/8] |= i << (i&7);
+                       c_cpumap[i/8] |= 1 << (i&7);
        }
        retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
                                     Int_val(vcpu), c_cpumap);
@@ -466,7 +466,7 @@
        ret = caml_alloc(len, 0);
 
        for (i=0; i<len; i++) {
-               if (c_cpumap[i%8] & 1 << (i&7))
+               if (c_cpumap[i/8] & 1 << (i&7))
                        Store_field(ret, i, Val_true);
                else
                        Store_field(ret, i, Val_false);
@@ -523,7 +523,7 @@
 
 CAMLprim value stub_xc_readconsolering(value xch)
 {
-       unsigned int size = RING_SIZE;
+       unsigned int size = RING_SIZE - 1;
        char *ring_ptr = ring;
 
        CAMLparam1(xch);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>