Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Split from ftrace_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 _GLOBAL_TOC(ftrace_caller)
0014     lbz r3, PACA_FTRACE_ENABLED(r13)
0015     cmpdi   r3, 0
0016     beqlr
0017 
0018     /* Taken from output of objdump from lib64/glibc */
0019     mflr    r3
0020     ld  r11, 0(r1)
0021     stdu    r1, -112(r1)
0022     std r3, 128(r1)
0023     ld  r4, 16(r11)
0024     subi    r3, r3, MCOUNT_INSN_SIZE
0025 .globl ftrace_call
0026 ftrace_call:
0027     bl  ftrace_stub
0028     nop
0029 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0030 .globl ftrace_graph_call
0031 ftrace_graph_call:
0032     b   ftrace_graph_stub
0033 _GLOBAL(ftrace_graph_stub)
0034 #endif
0035     ld  r0, 128(r1)
0036     mtlr    r0
0037     addi    r1, r1, 112
0038 
0039 _GLOBAL(ftrace_stub)
0040     blr
0041 
0042 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0043 _GLOBAL(ftrace_graph_caller)
0044     addi    r5, r1, 112
0045     /* load r4 with local address */
0046     ld  r4, 128(r1)
0047     subi    r4, r4, MCOUNT_INSN_SIZE
0048 
0049     /* Grab the LR out of the caller stack frame */
0050     ld  r11, 112(r1)
0051     ld  r3, 16(r11)
0052 
0053     bl  prepare_ftrace_return
0054     nop
0055 
0056     /*
0057      * prepare_ftrace_return gives us the address we divert to.
0058      * Change the LR in the callers stack frame to this.
0059      */
0060     ld  r11, 112(r1)
0061     std r3, 16(r11)
0062 
0063     ld  r0, 128(r1)
0064     mtlr    r0
0065     addi    r1, r1, 112
0066     blr
0067 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */