Commit 711e8b0d authored by Will Deacon's avatar Will Deacon

arm64: scs: Use 'scs_sp' register alias for x18

x18 holds the SCS stack pointer value, so introduce a register alias to
make this easier to read in assembly code.
Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent bee348fa
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#ifdef CONFIG_SHADOW_CALL_STACK #ifdef CONFIG_SHADOW_CALL_STACK
scs_sp .req x18
.macro scs_load tsk, tmp .macro scs_load tsk, tmp
ldr x18, [\tsk, #TSK_TI_SCS_SP] ldr scs_sp, [\tsk, #TSK_TI_SCS_SP]
.endm .endm
.macro scs_save tsk, tmp .macro scs_save tsk, tmp
str x18, [\tsk, #TSK_TI_SCS_SP] str scs_sp, [\tsk, #TSK_TI_SCS_SP]
.endm .endm
#else #else
.macro scs_load tsk, tmp .macro scs_load tsk, tmp
......
...@@ -394,7 +394,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 ...@@ -394,7 +394,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
.macro irq_stack_entry .macro irq_stack_entry
mov x19, sp // preserve the original sp mov x19, sp // preserve the original sp
#ifdef CONFIG_SHADOW_CALL_STACK #ifdef CONFIG_SHADOW_CALL_STACK
mov x24, x18 // preserve the original shadow stack mov x24, scs_sp // preserve the original shadow stack
#endif #endif
/* /*
...@@ -416,7 +416,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 ...@@ -416,7 +416,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
#ifdef CONFIG_SHADOW_CALL_STACK #ifdef CONFIG_SHADOW_CALL_STACK
/* also switch to the irq shadow stack */ /* also switch to the irq shadow stack */
adr_this_cpu x18, irq_shadow_call_stack, x26 adr_this_cpu scs_sp, irq_shadow_call_stack, x26
#endif #endif
9998: 9998:
...@@ -430,7 +430,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 ...@@ -430,7 +430,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
.macro irq_stack_exit .macro irq_stack_exit
mov sp, x19 mov sp, x19
#ifdef CONFIG_SHADOW_CALL_STACK #ifdef CONFIG_SHADOW_CALL_STACK
mov x18, x24 mov scs_sp, x24
#endif #endif
.endm .endm
...@@ -1071,9 +1071,9 @@ SYM_CODE_START(__sdei_asm_handler) ...@@ -1071,9 +1071,9 @@ SYM_CODE_START(__sdei_asm_handler)
#ifdef CONFIG_SHADOW_CALL_STACK #ifdef CONFIG_SHADOW_CALL_STACK
/* Use a separate shadow call stack for normal and critical events */ /* Use a separate shadow call stack for normal and critical events */
cbnz w4, 3f cbnz w4, 3f
adr_this_cpu dst=x18, sym=sdei_shadow_call_stack_normal, tmp=x6 adr_this_cpu dst=scs_sp, sym=sdei_shadow_call_stack_normal, tmp=x6
b 4f b 4f
3: adr_this_cpu dst=x18, sym=sdei_shadow_call_stack_critical, tmp=x6 3: adr_this_cpu dst=scs_sp, sym=sdei_shadow_call_stack_critical, tmp=x6
4: 4:
#endif #endif
......
...@@ -426,7 +426,7 @@ SYM_FUNC_START_LOCAL(__primary_switched) ...@@ -426,7 +426,7 @@ SYM_FUNC_START_LOCAL(__primary_switched)
mov x29, sp mov x29, sp
#ifdef CONFIG_SHADOW_CALL_STACK #ifdef CONFIG_SHADOW_CALL_STACK
adr_l x18, init_shadow_call_stack // Set shadow call stack adr_l scs_sp, init_shadow_call_stack // Set shadow call stack
#endif #endif
str_l x21, __fdt_pointer, x5 // Save FDT pointer str_l x21, __fdt_pointer, x5 // Save FDT pointer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment