1 /* SPDX-License-Identifier: GPL-2.0 */
3 * trampoline entry and return code for kretprobes.
6 #include <linux/linkage.h>
7 #include <asm/asm-offsets.h>
8 #include <asm/assembler.h>
12 .macro save_all_base_regs
13 stp x0, x1, [sp, #S_X0]
14 stp x2, x3, [sp, #S_X2]
15 stp x4, x5, [sp, #S_X4]
16 stp x6, x7, [sp, #S_X6]
17 stp x8, x9, [sp, #S_X8]
18 stp x10, x11, [sp, #S_X10]
19 stp x12, x13, [sp, #S_X12]
20 stp x14, x15, [sp, #S_X14]
21 stp x16, x17, [sp, #S_X16]
22 stp x18, x19, [sp, #S_X18]
23 stp x20, x21, [sp, #S_X20]
24 stp x22, x23, [sp, #S_X22]
25 stp x24, x25, [sp, #S_X24]
26 stp x26, x27, [sp, #S_X26]
27 stp x28, x29, [sp, #S_X28]
28 add x0, sp, #S_FRAME_SIZE
29 stp lr, x0, [sp, #S_LR]
31 * Construct a useful saved PSTATE
40 stp xzr, x0, [sp, #S_PC]
43 .macro restore_all_base_regs
44 ldr x0, [sp, #S_PSTATE]
45 and x0, x0, #(PSR_N_BIT | PSR_Z_BIT | PSR_C_BIT | PSR_V_BIT)
47 ldp x0, x1, [sp, #S_X0]
48 ldp x2, x3, [sp, #S_X2]
49 ldp x4, x5, [sp, #S_X4]
50 ldp x6, x7, [sp, #S_X6]
51 ldp x8, x9, [sp, #S_X8]
52 ldp x10, x11, [sp, #S_X10]
53 ldp x12, x13, [sp, #S_X12]
54 ldp x14, x15, [sp, #S_X14]
55 ldp x16, x17, [sp, #S_X16]
56 ldp x18, x19, [sp, #S_X18]
57 ldp x20, x21, [sp, #S_X20]
58 ldp x22, x23, [sp, #S_X22]
59 ldp x24, x25, [sp, #S_X24]
60 ldp x26, x27, [sp, #S_X26]
61 ldp x28, x29, [sp, #S_X28]
64 SYM_CODE_START(kretprobe_trampoline)
65 sub sp, sp, #S_FRAME_SIZE
70 bl trampoline_probe_handler
72 * Replace trampoline address in lr with actual orig_ret_addr return
79 add sp, sp, #S_FRAME_SIZE
82 SYM_CODE_END(kretprobe_trampoline)