Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Split from entry_64.S
0004  */
0005 
0006 #include <linux/magic.h>
0007 #include <asm/ppc_asm.h>
0008 #include <asm/asm-offsets.h>
0009 #include <asm/ftrace.h>
0010 #include <asm/ppc-opcode.h>
0011 #include <asm/export.h>
0012 
0013 #ifdef CONFIG_PPC64
0014 .pushsection ".tramp.ftrace.text","aw",@progbits;
0015 .globl ftrace_tramp_text
0016 ftrace_tramp_text:
0017     .space 64
0018 .popsection
0019 
0020 .pushsection ".tramp.ftrace.init","aw",@progbits;
0021 .globl ftrace_tramp_init
0022 ftrace_tramp_init:
0023     .space 64
0024 .popsection
0025 #endif
0026 
0027 _GLOBAL(mcount)
0028 _GLOBAL(_mcount)
0029 EXPORT_SYMBOL(_mcount)
0030     mflr    r12
0031     mtctr   r12
0032     mtlr    r0
0033     bctr
0034 
0035 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0036 _GLOBAL(return_to_handler)
0037     /* need to save return values */
0038 #ifdef CONFIG_PPC64
0039     std r4,  -32(r1)
0040     std r3,  -24(r1)
0041     /* save TOC */
0042     std r2,  -16(r1)
0043     std r31, -8(r1)
0044     mr  r31, r1
0045     stdu    r1, -112(r1)
0046 
0047     /*
0048      * We might be called from a module.
0049      * Switch to our TOC to run inside the core kernel.
0050      */
0051     ld  r2, PACATOC(r13)
0052 #else
0053     stwu    r1, -16(r1)
0054     stw r3, 8(r1)
0055     stw r4, 12(r1)
0056 #endif
0057 
0058     bl  ftrace_return_to_handler
0059     nop
0060 
0061     /* return value has real return address */
0062     mtlr    r3
0063 
0064 #ifdef CONFIG_PPC64
0065     ld  r1, 0(r1)
0066     ld  r4,  -32(r1)
0067     ld  r3,  -24(r1)
0068     ld  r2,  -16(r1)
0069     ld  r31, -8(r1)
0070 #else
0071     lwz r3, 8(r1)
0072     lwz r4, 12(r1)
0073     addi    r1, r1, 16
0074 #endif
0075 
0076     /* Jump back to real return address */
0077     blr
0078 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */