Handle the uint32_t in the tbuf
PATCH 3/3 Handle the uint32_t in the tbuf
Signed-off-by Jimi Xenidis <[email protected]>
---
tools/libxc/xc_tbuf.c +14 -4
@@ -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;