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-ppc-devel

[XenPPC] [xenppc-unstable] [ppc] new 32/64 bit safe XEN_GUEST_HANDLE

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [ppc] new 32/64 bit safe XEN_GUEST_HANDLE
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Jun 2006 17:10:42 +0000
Delivery-date: Thu, 29 Jun 2006 10:14:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 3f312d18514474bdf7b21a427d7c71e3bc88a323
# Parent  10db0f8c710da9d581a03d72594b063858833a97
[ppc] new 32/64 bit safe XEN_GUEST_HANDLE

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/include/asm-ppc/guest_access.h |    4 +++-
 xen/include/public/arch-ppc64.h    |   25 ++++++++++++++++++-------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff -r 10db0f8c710d -r 3f312d185144 xen/include/asm-ppc/guest_access.h
--- a/xen/include/asm-ppc/guest_access.h        Wed Jun 28 15:37:45 2006 -0400
+++ b/xen/include/asm-ppc/guest_access.h        Thu Jun 29 12:52:54 2006 -0400
@@ -39,7 +39,9 @@ extern void xencomm_add_offset(void *han
 /* Cast a guest handle to the specified type of handle. */
 #define guest_handle_cast(hnd, type) ({         \
     type *_x = (hnd).p;                         \
-    (XEN_GUEST_HANDLE(type)) { _x };                \
+    XEN_GUEST_HANDLE(type) _y; \
+    set_xen_guest_handle(_y, _x); \
+    _y; \
 })
 
 /* Since we run in real mode, we can safely access all addresses. That also
diff -r 10db0f8c710d -r 3f312d185144 xen/include/public/arch-ppc64.h
--- a/xen/include/public/arch-ppc64.h   Wed Jun 28 15:37:45 2006 -0400
+++ b/xen/include/public/arch-ppc64.h   Thu Jun 29 12:52:54 2006 -0400
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
  */
@@ -27,11 +27,20 @@
 #endif
 
 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
-    typedef struct { type *p; } __guest_handle_ ## name
+    typedef struct { \
+        int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
+        type *p; \
+    } __attribute__((__aligned__(8))) __guest_handle_ ## name
 
 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
 #define XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
-#define set_xen_guest_handle(hnd, val)  do { (hnd).p = val; } while (0)
+#define set_xen_guest_handle(hnd, val) \
+    do { \
+        if (sizeof ((hnd).__pad)) \
+            (hnd).__pad[0] = 0; \
+        (hnd).p = val; \
+    } while (0)
+
 #ifdef __XEN_TOOLS__
 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
 #endif
@@ -70,7 +79,7 @@ typedef unsigned long cpureg_t;   /* Ful
 
 /* User-accessible registers: need to be saved/restored for every nested Xen
  * invocation. */
-typedef struct cpu_user_regs
+struct cpu_user_regs
 {
     uint64_t gprs[32];
     uint64_t lr;
@@ -84,16 +93,18 @@ typedef struct cpu_user_regs
     uint64_t hid4;
     uint32_t cr;
     uint32_t entry_vector;
-} cpu_user_regs_t;
+};
+typedef struct cpu_user_regs cpu_user_regs_t;
 
 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ /* XXX timebase */
 
 /* ONLY used to communicate with dom0! See also struct exec_domain. */
-typedef struct vcpu_guest_context {
+struct vcpu_guest_context {
     cpu_user_regs_t user_regs;         /* User-level CPU registers     */
     uint64_t sdr1;                     /* Pagetable base               */
     /* XXX etc */
-} vcpu_guest_context_t;
+};
+typedef struct vcpu_guest_context vcpu_guest_context_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 
 struct arch_shared_info {

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [ppc] new 32/64 bit safe XEN_GUEST_HANDLE, Xen patchbot-xenppc-unstable <=