aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2014-09-16 10:55:12 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-09-26 05:41:17 -0400
commit8a574cfa2652545eb95595d38ac2a0bb501af0ae (patch)
tree9c49a781cda974d511d4239e172cdb10692d5cee /arch
parentc8c0da6bdf0f0d6f59fc23aab6ee373a131df82d (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/kernel/mcount.S12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 5d25462de8a6..2f7c734771f4 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -129,7 +129,11 @@ NESTED(_mcount, PT_SIZE, ra)
129 nop 129 nop
130#endif 130#endif
131 b ftrace_stub 131 b ftrace_stub
132#ifdef CONFIG_32BIT
133 addiu sp, sp, 8
134#else
132 nop 135 nop
136#endif
133 137
134static_trace: 138static_trace:
135 MCOUNT_SAVE_REGS 139 MCOUNT_SAVE_REGS
@@ -139,6 +143,9 @@ static_trace:
139 move a1, AT /* arg2: parent's return address */ 143 move a1, AT /* arg2: parent's return address */
140 144
141 MCOUNT_RESTORE_REGS 145 MCOUNT_RESTORE_REGS
146#ifdef CONFIG_32BIT
147 addiu sp, sp, 8
148#endif
142 .globl ftrace_stub 149 .globl ftrace_stub
143ftrace_stub: 150ftrace_stub:
144 RETURN_BACK 151 RETURN_BACK
@@ -183,6 +190,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
183 jal prepare_ftrace_return 190 jal prepare_ftrace_return
184 nop 191 nop
185 MCOUNT_RESTORE_REGS 192 MCOUNT_RESTORE_REGS
193#ifndef CONFIG_DYNAMIC_FTRACE
194#ifdef CONFIG_32BIT
195 addiu sp, sp, 8
196#endif
197#endif
186 RETURN_BACK 198 RETURN_BACK
187 END(ftrace_graph_caller) 199 END(ftrace_graph_caller)
188 200