Lines Matching +full:sub +full:- +full:frame

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * arch/arm64/kernel/entry-ftrace.S
11 #include <asm/asm-offsets.h>
18 * Due to -fpatchable-function-entry=2, the compiler has placed two NOPs before
25 * Each instrumented function follows the AAPCS, so here x0-x8 and x18-x30 are
26 * live (x18 holds the Shadow Call Stack pointer), and x9-x17 are safe to
30 * ftrace callbacks. So that we can get a sensible backtrace, we create frame
33 * record, its caller is missing from the LR and existing chain of frame
41 * The literal pointer to the ops is at an 8-byte aligned boundary
47 * aligning to an 8-byte boundary and subtracting 16. We do the
52 ldr x11, [x11, #-(4 * AARCH64_INSN_SIZE)] // op
59 ldr x17, [x11, #FTRACE_OPS_DIRECT_CALL] // op->direct_call
67 /* Make room for ftrace regs, plus two frame records */
68 sub sp, sp, #(FREGS_SIZE + 32)
89 /* Create a frame record for the callsite above the ftrace regs */
93 /* Create our frame record above the ftrace regs */
98 sub x0, x30, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
104 ldr x4, [x2, #FTRACE_OPS_FUNC] // op->func
105 blr x4 // op->func(ip, parent_ip, op, regs)
115 * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
116 * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
117 * to restore x0-x8, x29, and x30.
147 * The ftrace_regs are live, and x0-x8 and FP have been restored. The
184 * Gcc with -pg will put the following code in the beginning of each function:
193 * as long as the kernel is compiled without -fomit-frame-pointer.
198 * current sp/fp => 0:+-----+
199 * in _mcount() | x29 | -> instrumented function's fp
200 * +-----+
201 * | x30 | -> _mcount()'s lr (= instrumented function's pc)
202 * old sp => +16:+-----+
207 * instrumented => +xx:+-----+
208 * function's fp | x29 | -> parent's fp
209 * +-----+
210 * | x30 | -> instrumented function's lr (= parent's pc)
211 * +-----+
216 stp x29, x30, [sp, #-16]!
226 sub \rd, \rn, #AARCH64_INSN_SIZE
256 * _mcount() is used to build the kernel with -pg option, but all the branch
259 * NOP when disabled per-function base.
273 * - tracer function to probe instrumented function's entry,
274 * - ftrace_graph_caller to set up an exit hook
333 sub sp, sp, #FGRET_REGS_SIZE