Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wu Zhangjin and committed by
Ralf Baechle
fc49a3be 046199ca

+13 -13
+13 -13
arch/mips/kernel/mcount.S
··· 65 65 _mcount: 66 66 b ftrace_stub 67 67 nop 68 - lw t0, function_trace_stop 69 - bnez t0, ftrace_stub 68 + lw t1, function_trace_stop 69 + bnez t1, ftrace_stub 70 70 nop 71 71 72 72 MCOUNT_SAVE_REGS ··· 93 93 #else /* ! CONFIG_DYNAMIC_FTRACE */ 94 94 95 95 NESTED(_mcount, PT_SIZE, ra) 96 - lw t0, function_trace_stop 97 - bnez t0, ftrace_stub 96 + lw t1, function_trace_stop 97 + bnez t1, ftrace_stub 98 98 nop 99 - PTR_LA t0, ftrace_stub 100 - PTR_L t1, ftrace_trace_function /* Prepare t1 for (1) */ 101 - bne t0, t1, static_trace 99 + PTR_LA t1, ftrace_stub 100 + PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */ 101 + bne t1, t2, static_trace 102 102 nop 103 103 104 104 #ifdef CONFIG_FUNCTION_GRAPH_TRACER 105 - PTR_L t2, ftrace_graph_return 106 - bne t0, t2, ftrace_graph_caller 105 + PTR_L t3, ftrace_graph_return 106 + bne t1, t3, ftrace_graph_caller 107 107 nop 108 - PTR_LA t0, ftrace_graph_entry_stub 109 - PTR_L t2, ftrace_graph_entry 110 - bne t0, t2, ftrace_graph_caller 108 + PTR_LA t1, ftrace_graph_entry_stub 109 + PTR_L t3, ftrace_graph_entry 110 + bne t1, t3, ftrace_graph_caller 111 111 nop 112 112 #endif 113 113 b ftrace_stub ··· 117 117 MCOUNT_SAVE_REGS 118 118 119 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 121 move a1, AT /* arg2: the caller's next ip, parent */ 122 122 123 123 MCOUNT_RESTORE_REGS