]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - arch/powerpc/kernel/trace/ftrace_64.S
Merge tag 'v4.20' into next
[mirror_ubuntu-eoan-kernel.git] / arch / powerpc / kernel / trace / ftrace_64.S
1 /*
2 * Split from entry_64.S
3 *
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.
8 */
9
10 #include <linux/magic.h>
11 #include <asm/ppc_asm.h>
12 #include <asm/asm-offsets.h>
13 #include <asm/ftrace.h>
14 #include <asm/ppc-opcode.h>
15 #include <asm/export.h>
16
17 .pushsection ".tramp.ftrace.text","aw",@progbits;
18 .globl ftrace_tramp_text
19 ftrace_tramp_text:
20 .space 64
21 .popsection
22
23 .pushsection ".tramp.ftrace.init","aw",@progbits;
24 .globl ftrace_tramp_init
25 ftrace_tramp_init:
26 .space 64
27 .popsection
28
29 _GLOBAL(mcount)
30 _GLOBAL(_mcount)
31 EXPORT_SYMBOL(_mcount)
32 mflr r12
33 mtctr r12
34 mtlr r0
35 bctr
36
37 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
38 _GLOBAL(return_to_handler)
39 /* need to save return values */
40 std r4, -32(r1)
41 std r3, -24(r1)
42 /* save TOC */
43 std r2, -16(r1)
44 std r31, -8(r1)
45 mr r31, r1
46 stdu r1, -112(r1)
47
48 /*
49 * We might be called from a module.
50 * Switch to our TOC to run inside the core kernel.
51 */
52 ld r2, PACATOC(r13)
53
54 bl ftrace_return_to_handler
55 nop
56
57 /* return value has real return address */
58 mtlr r3
59
60 ld r1, 0(r1)
61 ld r4, -32(r1)
62 ld r3, -24(r1)
63 ld r2, -16(r1)
64 ld r31, -8(r1)
65
66 /* Jump back to real return address */
67 blr
68 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */