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

Re: [XenPPC] [rfc] [patch] 64-bitize guest handles

On Wed, 2006-06-28 at 06:34 -0400, Jimi Xenidis wrote:
> oops! a typo and an update, see below
> On Jun 27, 2006, at 6:15 PM, Jimi Xenidis wrote:
> > how about:
> >      struct __guest_handle_struct {
> >          char __pad[sizeof (long) - sizeof (void *)];
> needs to be:
>    char __pad[sizeof (u64) - sizeof (void *)];
> 
> Also, we will have to set the __pad member to zero or 32bit  
> "creators" will have garbage there, so let make it an u32:
> 
>    u32 __pad[(sizeof (u64) - sizeof (void *)) / 4];
> 
> and...
> > -#define set_xen_guest_handle(hnd, val)  do { (hnd).p = val; }  
> > while (0)
> > +#define set_xen_guest_handle(hnd, val) \
> > +    do { (hnd).l = (unsigned long)(void *)val; } while (0)
> 
>    #define set_xen_guest_handle(hnd, val) \
>        do { \
>            if (sizeof ((hnd).__pad)) \
>                (hnd).__pad = 0; \
>            (hnd).p = val; \
>        } while (0)

I like the union better than a struct with carefully-constructed
non-overlapping members. Also, the separate assignment to 0 would be
avoided.

-- 
Hollis Blanchard
IBM Linux Technology Center


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