Skip to content

Commit 711e8b0

Browse files
committed
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: Sami Tolvanen <[email protected]> Reviewed-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent bee348f commit 711e8b0

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

arch/arm64/include/asm/scs.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
#include <asm/asm-offsets.h>
88

99
#ifdef CONFIG_SHADOW_CALL_STACK
10+
scs_sp .req x18
11+
1012
.macro scs_load tsk, tmp
11-
ldr x18, [\tsk, #TSK_TI_SCS_SP]
13+
ldr scs_sp, [\tsk, #TSK_TI_SCS_SP]
1214
.endm
1315

1416
.macro scs_save tsk, tmp
15-
str x18, [\tsk, #TSK_TI_SCS_SP]
17+
str scs_sp, [\tsk, #TSK_TI_SCS_SP]
1618
.endm
1719
#else
1820
.macro scs_load tsk, tmp

arch/arm64/kernel/entry.S

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
394394
.macro irq_stack_entry
395395
mov x19, sp // preserve the original sp
396396
#ifdef CONFIG_SHADOW_CALL_STACK
397-
mov x24, x18 // preserve the original shadow stack
397+
mov x24, scs_sp // preserve the original shadow stack
398398
#endif
399399

400400
/*
@@ -416,7 +416,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
416416

417417
#ifdef CONFIG_SHADOW_CALL_STACK
418418
/* also switch to the irq shadow stack */
419-
adr_this_cpu x18, irq_shadow_call_stack, x26
419+
adr_this_cpu scs_sp, irq_shadow_call_stack, x26
420420
#endif
421421

422422
9998:
@@ -430,7 +430,7 @@ alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
430430
.macro irq_stack_exit
431431
mov sp, x19
432432
#ifdef CONFIG_SHADOW_CALL_STACK
433-
mov x18, x24
433+
mov scs_sp, x24
434434
#endif
435435
.endm
436436

@@ -1071,9 +1071,9 @@ SYM_CODE_START(__sdei_asm_handler)
10711071
#ifdef CONFIG_SHADOW_CALL_STACK
10721072
/* Use a separate shadow call stack for normal and critical events */
10731073
cbnz w4, 3f
1074-
adr_this_cpu dst=x18, sym=sdei_shadow_call_stack_normal, tmp=x6
1074+
adr_this_cpu dst=scs_sp, sym=sdei_shadow_call_stack_normal, tmp=x6
10751075
b 4f
1076-
3: adr_this_cpu dst=x18, sym=sdei_shadow_call_stack_critical, tmp=x6
1076+
3: adr_this_cpu dst=scs_sp, sym=sdei_shadow_call_stack_critical, tmp=x6
10771077
4:
10781078
#endif
10791079

arch/arm64/kernel/head.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ SYM_FUNC_START_LOCAL(__primary_switched)
426426
mov x29, sp
427427

428428
#ifdef CONFIG_SHADOW_CALL_STACK
429-
adr_l x18, init_shadow_call_stack // Set shadow call stack
429+
adr_l scs_sp, init_shadow_call_stack // Set shadow call stack
430430
#endif
431431

432432
str_l x21, __fdt_pointer, x5 // Save FDT pointer

0 commit comments

Comments
 (0)