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

Re: [Xen-devel] 32/64-bit hypercall interface - padding

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] 32/64-bit hypercall interface - padding
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Tue, 4 Oct 2005 17:04:52 -0500
Cc: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>, Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>
Delivery-date: Tue, 04 Oct 2005 22:03:24 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <17218.64190.664635.703245@xxxxxxxxxxxxxxxxxxxxx>
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>
Organization: IBM Linux Technology Center
References: <A95E2296287EAD4EB592B5DEEFCE0E9D32E0D9@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <200510041641.43614.hollisb@xxxxxxxxxx> <17218.64190.664635.703245@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.8.2
On Tuesday 04 October 2005 16:57, Jimi Xenidis wrote:
>
> Nice idea but not sufficient cuz the pointer could be in the worng
> place you probably want
>   struct {
>         char _pad[sizeof (u64) - sizeof (long)];
>         vcpu_guest_context_t *ptr;
>  } ctxt;

Good catch. And this goes one step further to hide it:

#define PAD_POINTER char _pad[sizeof(u64) - sizeof(void*)]
typedef struct {
    ...
    union {
        PAD_POINTER;
        vcpu_guest_context_t *ptr;
    } ctxt;
} dom0_setdomaininfo_t;

Or this:

#define PAD_POINTER(type, name) \
    union { \
        char _pad[sizeof(u64) - sizeof(void*)]; \
        type *ptr; \
    } name;
typedef struct {
    ...
    PAD_POINTER(vcpu_guest_context_t, ctxt);
} dom0_setdomaininfo_t;

That looks nice, but it may confuse tools like cscope. Of course, so would the 
original XENIF_PTR macro idea. So I think I like the first better.

-- 
Hollis Blanchard
IBM Linux Technology Center

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