In 32bit builds, Clang objects to using uint64_t's with 32bit asm operands.
In file included from /local/xen-test-framework.git/arch/x86/pv/traps.c:7:
/local/xen-test-framework.git/arch/x86/include/arch/lib.h:404:52: error:
invalid output size for constraint '=d'
asm volatile ("xgetbv" : "=a" (feat_lo), "=d" (feat_hi)
^
/local/xen-test-framework.git/arch/x86/include/arch/lib.h:412:59: error:
invalid input size for constraint 'd'
asm volatile ("xsetbv" :: "a" ((uint32_t)value), "d" (value >> 32),
^
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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) );
}