[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] uint64_aligned_t not compatible across gcc versions



gcc up to 3.3.x doesn't honor __attribute__((__aligned(..))) on typedef-s (and
in my opinion this was the correct behavior, as a typedef and its original type
must be fully exchangeable in all their uses). For this reason, I'd recommend
changing the definition of this type on x86_32 with below patch.

Further looking into how it is being used and therefore into the uses of
XEN_GUEST_HANDLE_64 I am not really clear about the intentions of that
macro and its companions: Reserving a 64-bit slot for a pointer would seem
nice for doing the compatibility layer, but turns out useless if the 32-bit
native implementation doesn't check the upper half of passed in values, as
that implies that the 64-bit compatibility layer must not assume these upper
bits are all zero or else it wouldn't be binary compatible.

Jan

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2006-08-28/xen/include/public/arch-x86_32.h
===================================================================
--- 2006-08-28.orig/xen/include/public/arch-x86_32.h    2006-08-28 
08:32:38.000000000 +0200
+++ 2006-08-28/xen/include/public/arch-x86_32.h 2006-08-28 16:35:11.000000000 
+0200
@@ -29,12 +29,14 @@
 
 /* Structural guest handles introduced in 0x00030201. */
 #if (defined(__XEN__) || defined(__XEN_TOOLS__)) && !defined(__ASSEMBLY__)
-typedef uint64_t __attribute__((aligned(8))) uint64_aligned_t;
+#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
 #define __DEFINE_XEN_GUEST_HANDLE(name, type)                   \
     typedef struct { type *p; }                                 \
         __guest_handle_ ## name;                                \
-    typedef struct { union { type *p; uint64_aligned_t q; }; }  \
-        __guest_handle_64_ ## name
+    typedef union {                                             \
+        type *p;                                                \
+        uint64_t __attribute__((__aligned__(8))) q;             \
+    } __guest_handle_64_ ## name
 #elif __XEN_INTERFACE_VERSION__ >= 0x00030201
 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
     typedef struct { type *p; } __guest_handle_ ## name


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.