2 * MIPS specific _mcount support
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive for
8 * Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University, China
9 * Author: Wu Zhangjin <wuzj@lemote.com>
12 #include <asm/regdef.h>
13 #include <asm/stackframe.h>
14 #include <asm/ftrace.h>
20 .macro MCOUNT_SAVE_REGS
36 .macro MCOUNT_RESTORE_REGS
52 PTR_ADDIU sp, (PT_SIZE + 8)
61 #ifdef CONFIG_DYNAMIC_FTRACE
63 NESTED(ftrace_caller, PT_SIZE, ra)
68 lw t0, function_trace_stop
74 move a0, ra /* arg1: next ip, selfaddr */
77 nop /* a placeholder for the call to a real tracing function */
78 move a1, AT /* arg2: the caller's next ip, parent */
86 #else /* ! CONFIG_DYNAMIC_FTRACE */
88 NESTED(_mcount, PT_SIZE, ra)
89 lw t0, function_trace_stop
92 PTR_LA t0, ftrace_stub
93 PTR_L t1, ftrace_trace_function /* Prepare t1 for (1) */
94 bne t0, t1, static_trace
102 move a0, ra /* arg1: next ip, selfaddr */
103 jalr t1 /* (1) call *ftrace_trace_function */
104 move a1, AT /* arg2: the caller's next ip, parent */
112 #endif /* ! CONFIG_DYNAMIC_FTRACE */