~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/kernel/trace/ftrace_64_pg_entry.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * Split from ftrace_64.S
  4  */
  5 
  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>
 12 
 13 _GLOBAL_TOC(ftrace_caller)
 14         lbz     r3, PACA_FTRACE_ENABLED(r13)
 15         cmpdi   r3, 0
 16         beqlr
 17 
 18         /* Taken from output of objdump from lib64/glibc */
 19         mflr    r3
 20         ld      r11, 0(r1)
 21         stdu    r1, -112(r1)
 22         std     r3, 128(r1)
 23         ld      r4, 16(r11)
 24         subi    r3, r3, MCOUNT_INSN_SIZE
 25 .globl ftrace_call
 26 ftrace_call:
 27         bl      ftrace_stub
 28         nop
 29 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 30 .globl ftrace_graph_call
 31 ftrace_graph_call:
 32         b       ftrace_graph_stub
 33 _GLOBAL(ftrace_graph_stub)
 34 #endif
 35         ld      r0, 128(r1)
 36         mtlr    r0
 37         addi    r1, r1, 112
 38 
 39 _GLOBAL(ftrace_stub)
 40         blr
 41 
 42 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 43 _GLOBAL(ftrace_graph_caller)
 44         addi    r5, r1, 112
 45         /* load r4 with local address */
 46         ld      r4, 128(r1)
 47         subi    r4, r4, MCOUNT_INSN_SIZE
 48 
 49         /* Grab the LR out of the caller stack frame */
 50         ld      r11, 112(r1)
 51         ld      r3, 16(r11)
 52 
 53         bl      prepare_ftrace_return
 54         nop
 55 
 56         /*
 57          * prepare_ftrace_return gives us the address we divert to.
 58          * Change the LR in the callers stack frame to this.
 59          */
 60         ld      r11, 112(r1)
 61         std     r3, 16(r11)
 62 
 63         ld      r0, 128(r1)
 64         mtlr    r0
 65         addi    r1, r1, 112
 66         blr
 67 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 68 
 69 .pushsection ".tramp.ftrace.text","aw",@progbits;
 70 .globl ftrace_tramp_text
 71 ftrace_tramp_text:
 72         .space 32
 73 .popsection
 74 
 75 .pushsection ".tramp.ftrace.init","aw",@progbits;
 76 .globl ftrace_tramp_init
 77 ftrace_tramp_init:
 78         .space 32
 79 .popsection
 80 
 81 _GLOBAL(mcount)
 82 _GLOBAL(_mcount)
 83 EXPORT_SYMBOL(_mcount)
 84         mflr    r12
 85         mtctr   r12
 86         mtlr    r0
 87         bctr
 88 
 89 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 90 _GLOBAL(return_to_handler)
 91         /* need to save return values */
 92 #ifdef CONFIG_PPC64
 93         std     r4,  -32(r1)
 94         std     r3,  -24(r1)
 95         /* save TOC */
 96         std     r2,  -16(r1)
 97         std     r31, -8(r1)
 98         mr      r31, r1
 99         stdu    r1, -112(r1)
100 
101         /*
102          * We might be called from a module.
103          * Switch to our TOC to run inside the core kernel.
104          */
105         LOAD_PACA_TOC()
106 #else
107         stwu    r1, -16(r1)
108         stw     r3, 8(r1)
109         stw     r4, 12(r1)
110 #endif
111 
112         bl      ftrace_return_to_handler
113         nop
114 
115         /* return value has real return address */
116         mtlr    r3
117 
118 #ifdef CONFIG_PPC64
119         ld      r1, 0(r1)
120         ld      r4,  -32(r1)
121         ld      r3,  -24(r1)
122         ld      r2,  -16(r1)
123         ld      r31, -8(r1)
124 #else
125         lwz     r3, 8(r1)
126         lwz     r4, 12(r1)
127         addi    r1, r1, 16
128 #endif
129 
130         /* Jump back to real return address */
131         blr
132 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php