1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2017 Andes Technology Corporation */
4 #include <linux/init.h>
5 #include <linux/linkage.h>
8 #include <asm/unistd.h>
9 #include <asm/thread_info.h>
10 #include <asm/asm-offsets.h>
11 #include <asm-generic/export.h>
12 #include <asm/ftrace.h>
16 #define FENTRY_RA_OFFSET 12
17 #define ABI_SIZE_ON_STACK 72
30 addi sp, sp, -ABI_SIZE_ON_STACK
54 addi sp, sp, ABI_SIZE_ON_STACK
58 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
61 addi sp, sp, -PT_SIZE_ON_STACK
64 addi sp, sp, PT_SIZE_ON_STACK
66 addi sp, sp, -PT_SIZE_ON_STACK
104 addi sp, sp, PT_SIZE_ON_STACK
106 addi sp, sp, -PT_SIZE_ON_STACK
132 REG_L x26, PT_S10(sp)
133 REG_L x27, PT_S11(sp)
139 addi sp, sp, PT_SIZE_ON_STACK
142 #endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
147 addi a0, ra, -FENTRY_RA_OFFSET
148 la a1, function_trace_op
150 REG_L a1, ABI_SIZE_ON_STACK(sp)
157 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
158 addi a0, sp, ABI_SIZE_ON_STACK
160 addi a1, a1, -FENTRY_RA_OFFSET
161 #ifdef HAVE_FUNCTION_GRAPH_FP_TEST
165 .global ftrace_graph_call
170 ENDPROC(ftrace_caller)
172 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
173 ENTRY(ftrace_regs_caller)
176 addi a0, ra, -FENTRY_RA_OFFSET
177 la a1, function_trace_op
179 REG_L a1, PT_SIZE_ON_STACK(sp)
183 .global ftrace_regs_call
186 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
189 addi a1, a1, -FENTRY_RA_OFFSET
190 #ifdef HAVE_FUNCTION_GRAPH_FP_TEST
193 ftrace_graph_regs_call:
194 .global ftrace_graph_regs_call
200 ENDPROC(ftrace_regs_caller)
201 #endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */