WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 3/3] [XEN] Handle the uint32_t in the tbuf

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3/3] [XEN] Handle the uint32_t in the tbuf
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Wed, 17 Jan 2007 17:46:36 -0500
Cc: levon@xxxxxxxxxxxxxxxxx, xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 17 Jan 2007 14:50:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>

---

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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 3/3] [XEN] Handle the uint32_t in the tbuf, Jimi Xenidis <=