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

Re: [Xen-devel] [PATCH] linux/x86: avoid casting hypercallarguments to long



>>> Keir Fraser <Keir.Fraser@xxxxxxxxxxxx> 21.01.08 17:27 >>>
>On 21/1/08 15:18, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:
>
>> -  : "1" ((long)(a1))    \
>> +  : "1" ((a1)?:0)     \
>
>Most of the patch seems to be placing this construct all over the place.
>What's it for? How is x?:0 different from x?

In its type: This way, the type gets promoted to int for anything smaller
than int, but left alone if long (or wider) or pointer. Various gcc versions
appear to have various problems when not promoting to at least int...

>> + register typeof((a4)?:0) __arg4 asm("r10") = (a4); \
>> + register typeof((a5)?:0) __arg5 asm("r8") = (a5); \
>> +    "=d" (__ign3), "+r" (__arg4), "+r" (__arg5) \
>
>Is it guaranteed that gcc will keep the register variables in their assigned
>registers across the inline asm?

That's how they document it, so I suppose this is the canonical way
and can be expected to not break.

Jan


_______________________________________________
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®.