|
@@ -88,7 +88,8 @@
|
|
|
|
|
|
.if \el == 0
|
|
|
mrs x21, sp_el0
|
|
|
- get_thread_info tsk // Ensure MDSCR_EL1.SS is clear,
|
|
|
+ mov tsk, sp
|
|
|
+ and tsk, tsk, #~(THREAD_SIZE - 1) // Ensure MDSCR_EL1.SS is clear,
|
|
|
ldr x19, [tsk, #TI_FLAGS] // since we can unmask debug
|
|
|
disable_step_tsk x19, x20 // exceptions when scheduling.
|
|
|
.else
|
|
@@ -107,6 +108,13 @@
|
|
|
str x21, [sp, #S_SYSCALLNO]
|
|
|
.endif
|
|
|
|
|
|
+ /*
|
|
|
+ * Set sp_el0 to current thread_info.
|
|
|
+ */
|
|
|
+ .if \el == 0
|
|
|
+ msr sp_el0, tsk
|
|
|
+ .endif
|
|
|
+
|
|
|
/*
|
|
|
* Registers that may be useful after this macro is invoked:
|
|
|
*
|
|
@@ -164,8 +172,7 @@ alternative_endif
|
|
|
.endm
|
|
|
|
|
|
.macro get_thread_info, rd
|
|
|
- mov \rd, sp
|
|
|
- and \rd, \rd, #~(THREAD_SIZE - 1) // top of stack
|
|
|
+ mrs \rd, sp_el0
|
|
|
.endm
|
|
|
|
|
|
/*
|
|
@@ -599,6 +606,8 @@ ENTRY(cpu_switch_to)
|
|
|
ldp x29, x9, [x8], #16
|
|
|
ldr lr, [x8]
|
|
|
mov sp, x9
|
|
|
+ and x9, x9, #~(THREAD_SIZE - 1)
|
|
|
+ msr sp_el0, x9
|
|
|
ret
|
|
|
ENDPROC(cpu_switch_to)
|
|
|
|