Commit fc49a3be authored by Wu Zhangjin's avatar Wu Zhangjin Committed by Ralf Baechle

MIPS: Tracing: Reserve $12(t0) for mcount-ra-address of gcc 4.5

A new option -mmcount-ra-address for gcc 4.5 have been sent by David
Daney <ddaney@caviumnetworks.com> in the thread "MIPS: Add option to
pass return address location to _mcount", which help to record the
location of the return address(ra) for the function graph tracer of MIPS
to hijack the return address easier and safer. that option used the
$12(t0) register by default, so, we reserve it for it, and use t1,t2,t3
instead of t0,t1,t2.
Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Nicholas Mc Guire <der.herr@hofr.at>
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/680/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 046199ca
...@@ -65,8 +65,8 @@ NESTED(ftrace_caller, PT_SIZE, ra) ...@@ -65,8 +65,8 @@ NESTED(ftrace_caller, PT_SIZE, ra)
_mcount: _mcount:
b ftrace_stub b ftrace_stub
nop nop
lw t0, function_trace_stop lw t1, function_trace_stop
bnez t0, ftrace_stub bnez t1, ftrace_stub
nop nop
MCOUNT_SAVE_REGS MCOUNT_SAVE_REGS
...@@ -93,21 +93,21 @@ ftrace_stub: ...@@ -93,21 +93,21 @@ ftrace_stub:
#else /* ! CONFIG_DYNAMIC_FTRACE */ #else /* ! CONFIG_DYNAMIC_FTRACE */
NESTED(_mcount, PT_SIZE, ra) NESTED(_mcount, PT_SIZE, ra)
lw t0, function_trace_stop lw t1, function_trace_stop
bnez t0, ftrace_stub bnez t1, ftrace_stub
nop nop
PTR_LA t0, ftrace_stub PTR_LA t1, ftrace_stub
PTR_L t1, ftrace_trace_function /* Prepare t1 for (1) */ PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */
bne t0, t1, static_trace bne t1, t2, static_trace
nop nop
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
PTR_L t2, ftrace_graph_return PTR_L t3, ftrace_graph_return
bne t0, t2, ftrace_graph_caller bne t1, t3, ftrace_graph_caller
nop nop
PTR_LA t0, ftrace_graph_entry_stub PTR_LA t1, ftrace_graph_entry_stub
PTR_L t2, ftrace_graph_entry PTR_L t3, ftrace_graph_entry
bne t0, t2, ftrace_graph_caller bne t1, t3, ftrace_graph_caller
nop nop
#endif #endif
b ftrace_stub b ftrace_stub
...@@ -117,7 +117,7 @@ static_trace: ...@@ -117,7 +117,7 @@ static_trace:
MCOUNT_SAVE_REGS MCOUNT_SAVE_REGS
move a0, ra /* arg1: next ip, selfaddr */ move a0, ra /* arg1: next ip, selfaddr */
jalr t1 /* (1) call *ftrace_trace_function */ jalr t2 /* (1) call *ftrace_trace_function */
move a1, AT /* arg2: the caller's next ip, parent */ move a1, AT /* arg2: the caller's next ip, parent */
MCOUNT_RESTORE_REGS MCOUNT_RESTORE_REGS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment