xen/arm: Stringify the register name in sysreg read write macros
authorVijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Wed, 23 Jul 2014 13:41:48 +0000 (19:11 +0530)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 3 Sep 2014 11:49:36 +0000 (12:49 +0100)
The register name parameter in {READ,WRITE}_SYSREG{32,64}
macros is replaced as register name in mrs and msr assembly
instruction.

If this register name is macro indirection, the register
name is not replaced with designated macro. So replace the register
name with __stringify macro, which replaces register name
if it is macro

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
xen/include/asm-arm/arm64/processor.h

index 5bf086711c3b274b90103d38dbb07d0c6b180217..3a9c0cde0ffd1c86c1094828582caf21c9d811dd 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARM_ARM64_PROCESSOR_H
 #define __ASM_ARM_ARM64_PROCESSOR_H
 
+#include <xen/stringify.h>
+
 #ifndef __ASSEMBLY__
 
 /* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */
@@ -85,20 +87,20 @@ struct cpu_user_regs
 
 #define READ_SYSREG32(name) ({                          \
     uint32_t _r;                                        \
-    asm volatile("mrs  %0, "#name : "=r" (_r));         \
+    asm volatile("mrs  %0, "__stringify(name) : "=r" (_r));         \
     _r; })
 #define WRITE_SYSREG32(v, name) do {                    \
     uint32_t _r = v;                                    \
-    asm volatile("msr "#name", %0" : : "r" (_r));       \
+    asm volatile("msr "__stringify(name)", %0" : : "r" (_r));       \
 } while (0)
 
 #define WRITE_SYSREG64(v, name) do {                    \
     uint64_t _r = v;                                    \
-    asm volatile("msr "#name", %0" : : "r" (_r));       \
+    asm volatile("msr "__stringify(name)", %0" : : "r" (_r));       \
 } while (0)
 #define READ_SYSREG64(name) ({                          \
     uint64_t _r;                                        \
-    asm volatile("mrs  %0, "#name : "=r" (_r));         \
+    asm volatile("mrs  %0, "__stringify(name) : "=r" (_r));         \
     _r; })
 
 #define READ_SYSREG(name)     READ_SYSREG64(name)