From: Julien Grall Date: Wed, 27 Mar 2019 18:45:25 +0000 (+0000) Subject: xen/arm64: sysreg: Implement the 32-bit helpers using the 64-bit helpers X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2278 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a17138b0e7f12c9ba2ac538c017a55a4cf56d77f;p=xen.git xen/arm64: sysreg: Implement the 32-bit helpers using the 64-bit helpers Clang is pickier than GCC for the register size in asm statement. It expects the register size to match the value size. The instructions msr/mrs are expecting a 64-bit register. This means the implementation of the 32-bit helpers is not correct. The easiest solution is to implement the 32-bit helpers using the 64-bit helpers. Signed-off-by: Julien Grall Reviewed-by: Stefano --- diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm64/sysregs.h index 08585a969e..c60029d38f 100644 --- a/xen/include/asm-arm/arm64/sysregs.h +++ b/xen/include/asm-arm/arm64/sysregs.h @@ -59,14 +59,9 @@ /* Access to system registers */ -#define READ_SYSREG32(name) ({ \ - uint32_t _r; \ - asm volatile("mrs %0, "__stringify(name) : "=r" (_r)); \ - _r; }) -#define WRITE_SYSREG32(v, name) do { \ - uint32_t _r = v; \ - asm volatile("msr "__stringify(name)", %0" : : "r" (_r)); \ -} while (0) +#define READ_SYSREG32(name) ((uint32_t)READ_SYSREG64(name)) + +#define WRITE_SYSREG32(v, name) WRITE_SYSREG64((uint64_t)v, name) #define WRITE_SYSREG64(v, name) do { \ uint64_t _r = v; \