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

Re: [Xen-devel] [PATCH][XTF] allow x{g, s}etbv() to also be used in 32-bit code



On 09/03/17 10:22, Jan Beulich wrote:
> Their 64-bit register constraints prevented this so far.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Ah - I already noticed and fixed this in
http://xenbits.xen.org/gitweb/?p=xtf.git;a=commitdiff;h=07f29b74020fa3b3f4fc2209e620e71a838062b4

In fact, the patch is identical it seems.

Clang appears to interpret the static inlines even if they are not
instantiated in code.

~Andrew

>
> --- a/include/arch/x86/lib.h
> +++ b/include/arch/x86/lib.h
> @@ -398,18 +398,18 @@ static inline unsigned int str(void)
>  
>  static inline uint64_t xgetbv(uint32_t index)
>  {
> -    uint32_t feat_lo;
> -    uint64_t feat_hi;
> +    uint32_t feat_lo, feat_hi;
>  
>      asm volatile ("xgetbv" : "=a" (feat_lo), "=d" (feat_hi)
>                             :  "c" (index) );
>  
> -    return feat_lo | (feat_hi << 32);
> +    return feat_lo | ((uint64_t)feat_hi << 32);
>  }
>  
>  static inline void xsetbv(uint32_t index, uint64_t value)
>  {
> -    asm volatile ("xsetbv" :: "a" ((uint32_t)value), "d" (value >> 32),
> +    asm volatile ("xsetbv" :: "a" ((uint32_t)value),
> +                              "d" ((uint32_t)(value >> 32)),
>                                "c" (index) );
>  }
>  
>
>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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