diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2022-01-26 11:27:21 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2022-02-09 09:13:59 +0100 |
commit | dd12e97f3c7233a65a0125e5c5c793da16e1137d (patch) | |
tree | a90690633c18bbdb0ed3dffe6bbeef8d83cbba9e /arch/arm/probes/kprobes/actions-common.c | |
parent | 41918ec82eb6f80c8b401422f27ca76c85aa0cb7 (diff) |
ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds
Thumb2 code uses R7 as the frame pointer rather than R11, because the
opcodes to access it are generally shorter.
This means that there are cases where we cannot simply add it to the
clobber list of an asm() block, but need to preserve/restore it
explicitly, or the compiler may complain in some cases (e.g., Clang
builds with ftrace enabled).
Since R11 is not special in that case, clobber it instead, and use it to
preserve/restore the value of R7.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Diffstat (limited to 'arch/arm/probes/kprobes/actions-common.c')
-rw-r--r-- | arch/arm/probes/kprobes/actions-common.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/probes/kprobes/actions-common.c b/arch/arm/probes/kprobes/actions-common.c index 836aebe596cd..79171344dbeb 100644 --- a/arch/arm/probes/kprobes/actions-common.c +++ b/arch/arm/probes/kprobes/actions-common.c @@ -84,7 +84,8 @@ emulate_generic_r0_12_noflags(probes_opcode_t insn, register void *rfn asm("lr") = asi->insn_fn; __asm__ __volatile__ ( - "stmdb sp!, {%[regs], r11} \n\t" +ARM( "stmdb sp!, {%[regs], r11} \n\t" ) +THUMB( "stmdb sp!, {%[regs], r7} \n\t" ) "ldmia %[regs], {r0-r12} \n\t" #if __LINUX_ARM_ARCH__ >= 6 "blx %[fn] \n\t" @@ -96,10 +97,11 @@ emulate_generic_r0_12_noflags(probes_opcode_t insn, #endif "ldr lr, [sp], #4 \n\t" /* lr = regs */ "stmia lr, {r0-r12} \n\t" - "ldr r11, [sp], #4 \n\t" +ARM( "ldr r11, [sp], #4 \n\t" ) +THUMB( "ldr r7, [sp], #4 \n\t" ) : [regs] "=r" (rregs), [fn] "=r" (rfn) : "0" (rregs), "1" (rfn) - : "r0", "r2", "r3", "r4", "r5", "r6", "r7", + : "r0", "r2", "r3", "r4", "r5", "r6", ARM("r7") THUMB("r11"), "r8", "r9", "r10", "r12", "memory", "cc" ); } |