Lightly hide the 'var' inside the macros to read the arm special registers.
I just happenned to have 3rd party code using 'var' as the output variable which drew my attention to this. variables defined inside macros should be prefixed to avoid getting shadowed varable wanrings from clang.
This commit is contained in:
parent
4efd690068
commit
c749d68596
@ -36,12 +36,12 @@
|
||||
#define INSN_SIZE 4
|
||||
|
||||
#define READ_SPECIALREG(reg) \
|
||||
({ uint64_t val; \
|
||||
__asm __volatile("mrs %0, " __STRING(reg) : "=&r" (val)); \
|
||||
val; \
|
||||
({ uint64_t _val; \
|
||||
__asm __volatile("mrs %0, " __STRING(reg) : "=&r" (_val)); \
|
||||
_val; \
|
||||
})
|
||||
#define WRITE_SPECIALREG(reg, val) \
|
||||
__asm __volatile("msr " __STRING(reg) ", %0" : : "r"((uint64_t)val))
|
||||
#define WRITE_SPECIALREG(reg, _val) \
|
||||
__asm __volatile("msr " __STRING(reg) ", %0" : : "r"((uint64_t)_val))
|
||||
|
||||
/* CNTHCTL_EL2 - Counter-timer Hypervisor Control register */
|
||||
#define CNTHCTL_EVNTI_MASK (0xf << 4) /* Bit to trigger event stream */
|
||||
|
Loading…
Reference in New Issue
Block a user