xcp-1.6-updates/xen-4.1.hg

changeset 23307:32ab8989df67

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
author Zheng Li <zheng.li@eu.citrix.com>
date Tue Jul 03 13:48:07 2012 +0100 (2012-07-03)
parents ec75bfd8599c
children 0b947d466e3e
files tools/ocaml/libs/xc/xc_stubs.c
line diff
     1.1 --- a/tools/ocaml/libs/xc/xc_stubs.c	Wed Jun 20 09:37:29 2012 +0100
     1.2 +++ b/tools/ocaml/libs/xc/xc_stubs.c	Tue Jul 03 13:48:07 2012 +0100
     1.3 @@ -430,7 +430,7 @@ CAMLprim value stub_xc_vcpu_setaffinity(
     1.4  
     1.5  	for (i=0; i<len; i++) {
     1.6  		if (Bool_val(Field(cpumap, i)))
     1.7 -			c_cpumap[i/8] |= i << (i&7);
     1.8 +			c_cpumap[i/8] |= 1 << (i&7);
     1.9  	}
    1.10  	retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
    1.11  	                             Int_val(vcpu), c_cpumap);
    1.12 @@ -466,7 +466,7 @@ CAMLprim value stub_xc_vcpu_getaffinity(
    1.13  	ret = caml_alloc(len, 0);
    1.14  
    1.15  	for (i=0; i<len; i++) {
    1.16 -		if (c_cpumap[i%8] & 1 << (i&7))
    1.17 +		if (c_cpumap[i/8] & 1 << (i&7))
    1.18  			Store_field(ret, i, Val_true);
    1.19  		else
    1.20  			Store_field(ret, i, Val_false);
    1.21 @@ -523,7 +523,7 @@ static char ring[RING_SIZE];
    1.22  
    1.23  CAMLprim value stub_xc_readconsolering(value xch)
    1.24  {
    1.25 -	unsigned int size = RING_SIZE;
    1.26 +	unsigned int size = RING_SIZE - 1;
    1.27  	char *ring_ptr = ring;
    1.28  
    1.29  	CAMLparam1(xch);