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] uint64_aligned_t not compatible across gcc versions

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] uint64_aligned_t not compatible across gcc versions
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 28 Aug 2006 15:46:26 +0100
Delivery-date: Mon, 28 Aug 2006 07:47:01 -0700
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
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