Jimi Xenidis
2007-Jan-17 22:46 UTC
[Xen-devel] [PATCH 3/3] [XEN] Handle the uint32_t in the tbuf
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com> --- diff -r 58d6c9cb95c6 tools/libxc/xc_tbuf.c --- a/tools/libxc/xc_tbuf.c Wed Jan 17 14:57:04 2007 -0500 +++ b/tools/libxc/xc_tbuf.c Wed Jan 17 17:13:10 2007 -0500 @@ -96,15 +96,25 @@ int xc_tbuf_set_cpu_mask(int xc_handle, { DECLARE_SYSCTL; int ret = -1; + uint64_t mask64; + uint8_t local[sizeof (mask64)]; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_cpu_mask; - set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask); - sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8; +#ifdef XC_BIG_ENDIAN + mask64 = mask; +#else + mask64 = (uint64_t)mask << 32; +#endif - if ( lock_pages(&mask, sizeof(mask)) != 0 ) + bitmap_64_to_byte(local, &mask64, sizeof (mask64)); + + set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, local); + sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(local) * 8; + + if ( lock_pages(&local, sizeof(local)) != 0 ) { PERROR("Could not lock memory for Xen hypercall"); goto out; @@ -112,7 +122,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, ret = do_sysctl(xc_handle, &sysctl); - unlock_pages(&mask, sizeof(mask)); + unlock_pages(&local, sizeof(local)); out: return ret; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel