diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2014-09-16 14:55:12 (GMT) |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-09-26 09:41:17 (GMT) |
commit | 8a574cfa2652545eb95595d38ac2a0bb501af0ae (patch) | |
tree | 9c49a781cda974d511d4239e172cdb10692d5cee | |
parent | c8c0da6bdf0f0d6f59fc23aab6ee373a131df82d (diff) | |
download | linux-8a574cfa2652545eb95595d38ac2a0bb501af0ae.tar.xz |
MIPS: mcount: Adjust stack pointer for static trace in MIPS32
Every mcount() call in the MIPS 32-bit kernel is done as follows:
[...]
move at, ra
jal _mcount
addiu sp, sp, -8
[...]
but upon returning from the mcount() function, the stack pointer
is not adjusted properly. This is explained in details in 58b69401c797
(MIPS: Function tracer: Fix broken function tracing).
Commit ad8c396936e3 ("MIPS: Unbreak function tracer for 64-bit kernel.)
fixed the stack manipulation for 64-bit but it didn't fix it completely
for MIPS32.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: <stable@vger.kernel.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7792/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/mcount.S | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index 5d25462..2f7c734 100644 --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S @@ -129,7 +129,11 @@ NESTED(_mcount, PT_SIZE, ra) nop #endif b ftrace_stub +#ifdef CONFIG_32BIT + addiu sp, sp, 8 +#else nop +#endif static_trace: MCOUNT_SAVE_REGS @@ -139,6 +143,9 @@ static_trace: move a1, AT /* arg2: parent's return address */ MCOUNT_RESTORE_REGS +#ifdef CONFIG_32BIT + addiu sp, sp, 8 +#endif .globl ftrace_stub ftrace_stub: RETURN_BACK @@ -183,6 +190,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra) jal prepare_ftrace_return nop MCOUNT_RESTORE_REGS +#ifndef CONFIG_DYNAMIC_FTRACE +#ifdef CONFIG_32BIT + addiu sp, sp, 8 +#endif +#endif RETURN_BACK END(ftrace_graph_caller) |