Lines Matching +full:sub +full:- +full:function

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
19 * the regular function prologue. For an enabled callsite, ftrace_init_nop() and
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
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
68 sub sp, sp, #(FREGS_SIZE + 32)
70 /* Save function arguments */
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.
119 /* Restore function arguments */
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:
187 * [function's body ...]
192 * get lr(x30) of instrumented function at any time by winding up call stack
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:+-----+
204 * function calls | ... |
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
229 /* for instrumented function's parent */
235 /* for instrumented function */
256 * _mcount() is used to build the kernel with -pg option, but all the branch
259 * NOP when disabled per-function base.
269 * @return_address: return address to instrumented function
271 * This function is a counterpart of _mcount() in 'static' ftrace, and
273 * - tracer function to probe instrumented function's entry,
274 * - ftrace_graph_caller to set up an exit hook
279 mcount_get_pc0 x0 // function's pc
280 mcount_get_lr x1 // function's lr
301 * This function w/ prepare_ftrace_return() fakes link register's value on
302 * the call stack in order to intercept instrumented function's return path
306 mcount_get_pc x0 // function's pc
307 mcount_get_lr_addr x1 // pointer to function's saved lr
333 sub sp, sp, #FGRET_REGS_SIZE