root/arch/powerpc/kernel/trace/ftrace_64.S

/* [<][>][^][v][top][bottom][index][help] */
   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3  * Split from entry_64.S
   4  */
   5 
   6 #include <linux/magic.h>
   7 #include <asm/ppc_asm.h>
   8 #include <asm/asm-offsets.h>
   9 #include <asm/ftrace.h>
  10 #include <asm/ppc-opcode.h>
  11 #include <asm/export.h>
  12 
  13 .pushsection ".tramp.ftrace.text","aw",@progbits;
  14 .globl ftrace_tramp_text
  15 ftrace_tramp_text:
  16         .space 64
  17 .popsection
  18 
  19 .pushsection ".tramp.ftrace.init","aw",@progbits;
  20 .globl ftrace_tramp_init
  21 ftrace_tramp_init:
  22         .space 64
  23 .popsection
  24 
  25 _GLOBAL(mcount)
  26 _GLOBAL(_mcount)
  27 EXPORT_SYMBOL(_mcount)
  28         mflr    r12
  29         mtctr   r12
  30         mtlr    r0
  31         bctr
  32 
  33 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  34 _GLOBAL(return_to_handler)
  35         /* need to save return values */
  36         std     r4,  -32(r1)
  37         std     r3,  -24(r1)
  38         /* save TOC */
  39         std     r2,  -16(r1)
  40         std     r31, -8(r1)
  41         mr      r31, r1
  42         stdu    r1, -112(r1)
  43 
  44         /*
  45          * We might be called from a module.
  46          * Switch to our TOC to run inside the core kernel.
  47          */
  48         ld      r2, PACATOC(r13)
  49 
  50         bl      ftrace_return_to_handler
  51         nop
  52 
  53         /* return value has real return address */
  54         mtlr    r3
  55 
  56         ld      r1, 0(r1)
  57         ld      r4,  -32(r1)
  58         ld      r3,  -24(r1)
  59         ld      r2,  -16(r1)
  60         ld      r31, -8(r1)
  61 
  62         /* Jump back to real return address */
  63         blr
  64 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */

/* [<][>][^][v][top][bottom][index][help] */