aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ocaml/libs
diff options
context:
space:
mode:
authorJon Ludlam <jonathan.ludlam@eu.citrix.com>2011-10-10 16:41:16 +0100
committerJon Ludlam <jonathan.ludlam@eu.citrix.com>2011-10-10 16:41:16 +0100
commit542a913b88b7be95462e0c9e5f57b744e7b8b010 (patch)
treeca99e8d3ba20d8cf3bd9bd87aa05a8f82186b7f9 /tools/ocaml/libs
parentc69fddbd5dfa3004aaf2d0f2dde00c9ec3dd6d5d (diff)
downloadxen-542a913b88b7be95462e0c9e5f57b744e7b8b010.tar.gz
xen-542a913b88b7be95462e0c9e5f57b744e7b8b010.tar.bz2
xen-542a913b88b7be95462e0c9e5f57b744e7b8b010.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>
Diffstat (limited to 'tools/ocaml/libs')
-rw-r--r--tools/ocaml/libs/xc/xenctrl_stubs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index b57b50cb17..03923e8c6a 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_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);