Lines Matching +full:sub +full:- +full:function
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * arch/arm64/kernel/entry-ftrace.S
10 #include <asm/asm-offsets.h>
17 * Due to -fpatchable-function-entry=2, the compiler has placed two NOPs before
18 * the regular function prologue. For an enabled callsite, ftrace_init_nop() and
26 * Each instrumented function follows the AAPCS, so here x0-x8 and x18-x30 are
27 * live (x18 holds the Shadow Call Stack pointer), and x9-x17 are safe to
38 sub sp, sp, #(PT_REGS_SIZE + 16)
40 /* Save function arguments (and x9 for simplicity) */
47 /* Optionally save the callee-saved registers, always save the FP */
90 sub x0, x30, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
105 * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
106 * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
107 * to restore x0-x8, x29, and x30.
110 /* Restore function arguments */
131 sub x0, x0, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
142 * Gcc with -pg will put the following code in the beginning of each function:
145 * [function's body ...]
150 * get lr(x30) of instrumented function at any time by winding up call stack
151 * as long as the kernel is compiled without -fomit-frame-pointer.
156 * current sp/fp => 0:+-----+
157 * in _mcount() | x29 | -> instrumented function's fp
158 * +-----+
159 * | x30 | -> _mcount()'s lr (= instrumented function's pc)
160 * old sp => +16:+-----+
162 * function calls | ... |
165 * instrumented => +xx:+-----+
166 * function's fp | x29 | -> parent's fp
167 * +-----+
168 * | x30 | -> instrumented function's lr (= parent's pc)
169 * +-----+
174 stp x29, x30, [sp, #-16]!
184 sub \rd, \rn, #AARCH64_INSN_SIZE
187 /* for instrumented function's parent */
193 /* for instrumented function */
216 * @return_address: return address to instrumented function
218 * This function makes calls, if enabled, to:
219 * - tracer function to probe instrumented function's entry,
220 * - ftrace_graph_caller to set up an exit hook
230 mcount_get_pc x0 // function's pc
231 mcount_get_lr x1 // function's lr (= parent's pc)
252 * _mcount() is used to build the kernel with -pg option, but all the branch
255 * NOP when disabled per-function base.
265 * @return_address: return address to instrumented function
267 * This function is a counterpart of _mcount() in 'static' ftrace, and
269 * - tracer function to probe instrumented function's entry,
270 * - ftrace_graph_caller to set up an exit hook
275 mcount_get_pc0 x0 // function's pc
276 mcount_get_lr x1 // function's lr
298 * This function w/ prepare_ftrace_return() fakes link register's value on
299 * the call stack in order to intercept instrumented function's return path
303 mcount_get_pc x0 // function's pc
304 mcount_get_lr_addr x1 // pointer to function's saved lr
326 sub sp, sp, #64