1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Split from ftrace_64.S
6 #include <linux/export.h>
7 #include <linux/magic.h>
8 #include <asm/ppc_asm.h>
9 #include <asm/asm-offsets.h>
10 #include <asm/ftrace.h>
11 #include <asm/ppc-opcode.h>
13 _GLOBAL_TOC(ftrace_caller)
14 lbz r3, PACA_FTRACE_ENABLED(r13)
18 /* Taken from output of objdump from lib64/glibc */
24 subi r3, r3, MCOUNT_INSN_SIZE
29 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
30 .globl ftrace_graph_call
33 _GLOBAL(ftrace_graph_stub)
42 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
43 _GLOBAL(ftrace_graph_caller)
45 /* load r4 with local address */
47 subi r4, r4, MCOUNT_INSN_SIZE
49 /* Grab the LR out of the caller stack frame */
53 bl prepare_ftrace_return
57 * prepare_ftrace_return gives us the address we divert to.
58 * Change the LR in the callers stack frame to this.
67 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
69 .pushsection ".tramp.ftrace.text","aw",@progbits;
70 .globl ftrace_tramp_text
75 .pushsection ".tramp.ftrace.init","aw",@progbits;
76 .globl ftrace_tramp_init
83 EXPORT_SYMBOL(_mcount)
89 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
90 _GLOBAL(return_to_handler)
91 /* need to save return values */
102 * We might be called from a module.
103 * Switch to our TOC to run inside the core kernel.
112 bl ftrace_return_to_handler
115 /* return value has real return address */
130 /* Jump back to real return address */
132 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */