Compiling with clang on ARMv8 shows errors like:
./arch/arm/include/asm/system.h:162:32: note: use constraint modifier "w"
asm volatile("msr sctlr_el1, %0" : : "r" (val) : "cc");
^~
%w0
These errors are due to using an incorrect size for the variables used
for writing to and reading from special registers which have 64 bits on
ARMv8.
Mask off reserved bits when reading the exception level.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
static inline unsigned int current_el(void)
{
- unsigned int el;
+ unsigned long el;
+
asm volatile("mrs %0, CurrentEL" : "=r" (el) : : "cc");
- return el >> 2;
+ return 3 & (el >> 2);
}
static inline unsigned int get_sctlr(void)
{
- unsigned int el, val;
+ unsigned int el;
+ unsigned long val;
el = current_el();
if (el == 1)
return val;
}
-static inline void set_sctlr(unsigned int val)
+static inline void set_sctlr(unsigned long val)
{
unsigned int el;