Skip to content

Commit 71e7018

Browse files
Jianlin-lvctmarinas
authored andcommitted
arm64: rename S_FRAME_SIZE to PT_REGS_SIZE
S_FRAME_SIZE is the size of the pt_regs structure, no longer the size of the kernel stack frame, the name is misleading. In keeping with arm32, rename S_FRAME_SIZE to PT_REGS_SIZE. Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/20210112015813.2340969-1-Jianlin.Lv@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent b90d72a commit 71e7018

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

arch/arm64/kernel/asm-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int main(void)
7575
DEFINE(S_SDEI_TTBR1, offsetof(struct pt_regs, sdei_ttbr1));
7676
DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save));
7777
DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe));
78-
DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
78+
DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
7979
BLANK();
8080
#ifdef CONFIG_COMPAT
8181
DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, offsetof(struct compat_sigframe, uc.uc_mcontext.arm_r0));

arch/arm64/kernel/entry-ftrace.S

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
.macro ftrace_regs_entry, allregs=0
3737
/* Make room for pt_regs, plus a callee frame */
38-
sub sp, sp, #(S_FRAME_SIZE + 16)
38+
sub sp, sp, #(PT_REGS_SIZE + 16)
3939

4040
/* Save function arguments (and x9 for simplicity) */
4141
stp x0, x1, [sp, #S_X0]
@@ -61,15 +61,15 @@
6161
.endif
6262

6363
/* Save the callsite's SP and LR */
64-
add x10, sp, #(S_FRAME_SIZE + 16)
64+
add x10, sp, #(PT_REGS_SIZE + 16)
6565
stp x9, x10, [sp, #S_LR]
6666

6767
/* Save the PC after the ftrace callsite */
6868
str x30, [sp, #S_PC]
6969

7070
/* Create a frame record for the callsite above pt_regs */
71-
stp x29, x9, [sp, #S_FRAME_SIZE]
72-
add x29, sp, #S_FRAME_SIZE
71+
stp x29, x9, [sp, #PT_REGS_SIZE]
72+
add x29, sp, #PT_REGS_SIZE
7373

7474
/* Create our frame record within pt_regs. */
7575
stp x29, x30, [sp, #S_STACKFRAME]
@@ -120,7 +120,7 @@ ftrace_common_return:
120120
ldr x9, [sp, #S_PC]
121121

122122
/* Restore the callsite's SP */
123-
add sp, sp, #S_FRAME_SIZE + 16
123+
add sp, sp, #PT_REGS_SIZE + 16
124124

125125
ret x9
126126
SYM_CODE_END(ftrace_common)
@@ -130,7 +130,7 @@ SYM_CODE_START(ftrace_graph_caller)
130130
ldr x0, [sp, #S_PC]
131131
sub x0, x0, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
132132
add x1, sp, #S_LR // parent_ip (callsite's LR)
133-
ldr x2, [sp, #S_FRAME_SIZE] // parent fp (callsite's FP)
133+
ldr x2, [sp, #PT_REGS_SIZE] // parent fp (callsite's FP)
134134
bl prepare_ftrace_return
135135
b ftrace_common_return
136136
SYM_CODE_END(ftrace_graph_caller)

arch/arm64/kernel/entry.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ alternative_else_nop_endif
7575
.endif
7676
#endif
7777

78-
sub sp, sp, #S_FRAME_SIZE
78+
sub sp, sp, #PT_REGS_SIZE
7979
#ifdef CONFIG_VMAP_STACK
8080
/*
8181
* Test whether the SP has overflowed, without corrupting a GPR.
@@ -96,7 +96,7 @@ alternative_else_nop_endif
9696
* userspace, and can clobber EL0 registers to free up GPRs.
9797
*/
9898

99-
/* Stash the original SP (minus S_FRAME_SIZE) in tpidr_el0. */
99+
/* Stash the original SP (minus PT_REGS_SIZE) in tpidr_el0. */
100100
msr tpidr_el0, x0
101101

102102
/* Recover the original x0 value and stash it in tpidrro_el0 */
@@ -253,7 +253,7 @@ alternative_else_nop_endif
253253

254254
scs_load tsk, x20
255255
.else
256-
add x21, sp, #S_FRAME_SIZE
256+
add x21, sp, #PT_REGS_SIZE
257257
get_current_task tsk
258258
.endif /* \el == 0 */
259259
mrs x22, elr_el1
@@ -377,7 +377,7 @@ alternative_else_nop_endif
377377
ldp x26, x27, [sp, #16 * 13]
378378
ldp x28, x29, [sp, #16 * 14]
379379
ldr lr, [sp, #S_LR]
380-
add sp, sp, #S_FRAME_SIZE // restore sp
380+
add sp, sp, #PT_REGS_SIZE // restore sp
381381

382382
.if \el == 0
383383
alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
@@ -580,12 +580,12 @@ __bad_stack:
580580

581581
/*
582582
* Store the original GPRs to the new stack. The orginal SP (minus
583-
* S_FRAME_SIZE) was stashed in tpidr_el0 by kernel_ventry.
583+
* PT_REGS_SIZE) was stashed in tpidr_el0 by kernel_ventry.
584584
*/
585-
sub sp, sp, #S_FRAME_SIZE
585+
sub sp, sp, #PT_REGS_SIZE
586586
kernel_entry 1
587587
mrs x0, tpidr_el0
588-
add x0, x0, #S_FRAME_SIZE
588+
add x0, x0, #PT_REGS_SIZE
589589
str x0, [sp, #S_SP]
590590

591591
/* Stash the regs for handle_bad_stack */

arch/arm64/kernel/probes/kprobes_trampoline.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
stp x24, x25, [sp, #S_X24]
2626
stp x26, x27, [sp, #S_X26]
2727
stp x28, x29, [sp, #S_X28]
28-
add x0, sp, #S_FRAME_SIZE
28+
add x0, sp, #PT_REGS_SIZE
2929
stp lr, x0, [sp, #S_LR]
3030
/*
3131
* Construct a useful saved PSTATE
@@ -62,7 +62,7 @@
6262
.endm
6363

6464
SYM_CODE_START(kretprobe_trampoline)
65-
sub sp, sp, #S_FRAME_SIZE
65+
sub sp, sp, #PT_REGS_SIZE
6666

6767
save_all_base_regs
6868

@@ -76,7 +76,7 @@ SYM_CODE_START(kretprobe_trampoline)
7676

7777
restore_all_base_regs
7878

79-
add sp, sp, #S_FRAME_SIZE
79+
add sp, sp, #PT_REGS_SIZE
8080
ret
8181

8282
SYM_CODE_END(kretprobe_trampoline)

0 commit comments

Comments
 (0)