diff options
author | Zheng Li <zheng.li@eu.citrix.com> | 2012-07-03 13:48:07 +0100 |
---|---|---|
committer | Zheng Li <zheng.li@eu.citrix.com> | 2012-07-03 13:48:07 +0100 |
commit | c22a079fb104a9e92415b66294533893f008780d (patch) | |
tree | ab7c78d1597991811fbd93b00864b48b8dd19801 /tools | |
parent | 381b11e87376cc584f6ebc1962629443ae5a9841 (diff) | |
download | xen-c22a079fb104a9e92415b66294533893f008780d.tar.gz xen-c22a079fb104a9e92415b66294533893f008780d.tar.bz2 xen-c22a079fb104a9e92415b66294533893f008780d.zip |
tools/ocaml: Fix 2 bit-twiddling bugs and an off-by-one
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@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
xen-unstable changeset: 23940:187d59e32a58
xen-unstable date: Mon Oct 10 16:41:16 2011 +0100
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ocaml/libs/xc/xc_stubs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/ocaml/libs/xc/xc_stubs.c b/tools/ocaml/libs/xc/xc_stubs.c index b57b50cb17..03923e8c6a 100644 --- a/tools/ocaml/libs/xc/xc_stubs.c +++ b/tools/ocaml/libs/xc/xc_stubs.c @@ -430,7 +430,7 @@ CAMLprim value stub_xc_vcpu_setaffinity(value xch, value domid, 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 @@ CAMLprim value stub_xc_vcpu_getaffinity(value xch, value domid, 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 @@ static char ring[RING_SIZE]; CAMLprim value stub_xc_readconsolering(value xch) { - unsigned int size = RING_SIZE; + unsigned int size = RING_SIZE - 1; char *ring_ptr = ring; CAMLparam1(xch); |