2 * Split from entry_32.S
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
10 #include <linux/magic.h>
12 #include <asm/ppc_asm.h>
13 #include <asm/asm-offsets.h>
14 #include <asm/ftrace.h>
15 #include <asm/export.h>
20 * It is required that _mcount on PPC32 must preserve the
21 * link register. But we have r0 to play with. We use r0
22 * to push the return address back to the caller of mcount
23 * into the ctr register, restore the link register and
24 * then jump back using the ctr register.
32 _GLOBAL(ftrace_caller)
34 /* r3 ends up with link register */
35 subi r3, r3, MCOUNT_INSN_SIZE
40 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
41 .globl ftrace_graph_call
44 _GLOBAL(ftrace_graph_stub)
47 /* old link register ends up in ctr reg */
50 EXPORT_SYMBOL(_mcount)
55 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
56 _GLOBAL(ftrace_graph_caller)
57 /* load r4 with local address */
59 subi r4, r4, MCOUNT_INSN_SIZE
61 /* Grab the LR out of the caller stack frame */
64 bl prepare_ftrace_return
68 * prepare_ftrace_return gives us the address we divert to.
69 * Change the LR in the callers stack frame to this.
74 /* old link register ends up in ctr reg */
77 _GLOBAL(return_to_handler)
78 /* need to save return values */
85 bl ftrace_return_to_handler
88 /* return value has real return address */
96 /* Jump back to real return address */
98 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */