aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/mcount.S
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2009-11-20 07:34:37 -0500
committerRalf Baechle <ralf@linux-mips.org>2009-12-16 20:57:26 -0500
commitfc49a3be2be7a0cd44fcd3b37557d6d92cae59b1 (patch)
treed216d6b5a23c85ee5bcd3b92dd62a4c6718bd72e /arch/mips/kernel/mcount.S
parent046199cae714a7f9e88f5a7940b077f4515f48cb (diff)
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: Wu 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: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/mcount.S')
-rw-r--r--arch/mips/kernel/mcount.S26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index bdfef2c24f16..522e91c688fc 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -65,8 +65,8 @@ NESTED(ftrace_caller, PT_SIZE, ra)
65_mcount: 65_mcount:
66 b ftrace_stub 66 b ftrace_stub
67 nop 67 nop
68 lw t0, function_trace_stop 68 lw t1, function_trace_stop
69 bnez t0, ftrace_stub 69 bnez t1, ftrace_stub
70 nop 70 nop
71 71
72 MCOUNT_SAVE_REGS 72 MCOUNT_SAVE_REGS
@@ -93,21 +93,21 @@ ftrace_stub:
93#else /* ! CONFIG_DYNAMIC_FTRACE */ 93#else /* ! CONFIG_DYNAMIC_FTRACE */
94 94
95NESTED(_mcount, PT_SIZE, ra) 95NESTED(_mcount, PT_SIZE, ra)
96 lw t0, function_trace_stop 96 lw t1, function_trace_stop
97 bnez t0, ftrace_stub 97 bnez t1, ftrace_stub
98 nop 98 nop
99 PTR_LA t0, ftrace_stub 99 PTR_LA t1, ftrace_stub
100 PTR_L t1, ftrace_trace_function /* Prepare t1 for (1) */ 100 PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */
101 bne t0, t1, static_trace 101 bne t1, t2, static_trace
102 nop 102 nop
103 103
104#ifdef CONFIG_FUNCTION_GRAPH_TRACER 104#ifdef CONFIG_FUNCTION_GRAPH_TRACER
105 PTR_L t2, ftrace_graph_return 105 PTR_L t3, ftrace_graph_return
106 bne t0, t2, ftrace_graph_caller 106 bne t1, t3, ftrace_graph_caller
107 nop 107 nop
108 PTR_LA t0, ftrace_graph_entry_stub 108 PTR_LA t1, ftrace_graph_entry_stub
109 PTR_L t2, ftrace_graph_entry 109 PTR_L t3, ftrace_graph_entry
110 bne t0, t2, ftrace_graph_caller 110 bne t1, t3, ftrace_graph_caller
111 nop 111 nop
112#endif 112#endif
113 b ftrace_stub 113 b ftrace_stub
@@ -117,7 +117,7 @@ static_trace:
117 MCOUNT_SAVE_REGS 117 MCOUNT_SAVE_REGS
118 118
119 move a0, ra /* arg1: next ip, selfaddr */ 119 move a0, ra /* arg1: next ip, selfaddr */
120 jalr t1 /* (1) call *ftrace_trace_function */ 120 jalr t2 /* (1) call *ftrace_trace_function */
121 move a1, AT /* arg2: the caller's next ip, parent */ 121 move a1, AT /* arg2: the caller's next ip, parent */
122 122
123 MCOUNT_RESTORE_REGS 123 MCOUNT_RESTORE_REGS