MIPS: Tracing: Cleanup the arguments passing of prepare_ftrace_return

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips <linux-mips@linux-mips.org>
Cc: David Daney <david.s.daney@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/1226/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Wu Zhangjin 2010-05-14 19:08:27 +08:00 committed by Ralf Baechle
parent 27b118342f
commit cbe555b01b

View File

@ -132,28 +132,34 @@ ftrace_stub:
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
NESTED(ftrace_graph_caller, PT_SIZE, ra) NESTED(ftrace_graph_caller, PT_SIZE, ra)
#ifdef CONFIG_DYNAMIC_FTRACE #ifndef CONFIG_DYNAMIC_FTRACE
PTR_L a1, PT_R31(sp) /* load the original ra from the stack */
#ifdef KBUILD_MCOUNT_RA_ADDRESS
PTR_L t0, PT_R12(sp) /* load the original t0 from the stack */
#endif
#else
MCOUNT_SAVE_REGS MCOUNT_SAVE_REGS
move a1, ra /* arg2: next ip, selfaddr */
#endif #endif
/* arg1: Get the location of the parent's return address */
#ifdef KBUILD_MCOUNT_RA_ADDRESS #ifdef KBUILD_MCOUNT_RA_ADDRESS
bnez t0, 1f /* non-leaf func: t0 saved the location of the return address */ #ifdef CONFIG_DYNAMIC_FTRACE
nop PTR_L a0, PT_R12(sp)
PTR_LA t0, PT_R1(sp) /* leaf func: get the location of at(old ra) from our own stack */
1: move a0, t0 /* arg1: the location of the return address */
#else #else
PTR_LA a0, PT_R1(sp) /* arg1: &AT -> a0 */ move a0, t0
#endif #endif
jal prepare_ftrace_return bnez a0, 1f /* non-leaf func: stored in t0 */
#ifdef CONFIG_FRAME_POINTER nop
move a2, fp /* arg3: frame pointer */ #endif
PTR_LA a0, PT_R1(sp) /* leaf func: the location in current stack */
1:
/* arg2: Get self return address */
#ifdef CONFIG_DYNAMIC_FTRACE
PTR_L a1, PT_R31(sp)
#else #else
move a1, ra
#endif
/* arg3: Get frame pointer of current stack */
#ifdef CONFIG_FRAME_POINTER
move a2, fp
#else /* ! CONFIG_FRAME_POINTER */
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
PTR_LA a2, PT_SIZE(sp) PTR_LA a2, PT_SIZE(sp)
#else #else
@ -161,6 +167,8 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
#endif #endif
#endif #endif
jal prepare_ftrace_return
nop
MCOUNT_RESTORE_REGS MCOUNT_RESTORE_REGS
RETURN_BACK RETURN_BACK
END(ftrace_graph_caller) END(ftrace_graph_caller)