diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-07-11 08:06:53 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-07-11 08:06:53 -0400 |
commit | e460ab27b6c3ea313762169713086529d5bfb8bc (patch) | |
tree | a3d0cba85bf3118da4465037c18c6390cac14635 /arch/sh/lib | |
parent | a470b95e99ea77ef1e307ff181e59a4a16caa4f4 (diff) |
sh: Fix up stack overflow check with ftrace disabled.
Presently the STACK_CHECK() code is called in to multiple times, although
it's only necessary from the mcount entry. The code still attempts to
treat the nop case as an ftrace path resulting in superfluous code flow
for the case where ftrace is disabled. And finally, this also fixes up
references to a few undefined symbols when FUNCTION_TRACER=n.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/lib')
-rw-r--r-- | arch/sh/lib/mcount.S | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/arch/sh/lib/mcount.S b/arch/sh/lib/mcount.S index 9e397aafc165..84a57761f17e 100644 --- a/arch/sh/lib/mcount.S +++ b/arch/sh/lib/mcount.S | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/lib/mcount.S | 2 | * arch/sh/lib/mcount.S |
3 | * | 3 | * |
4 | * Copyright (C) 2008 Paul Mundt | 4 | * Copyright (C) 2008, 2009 Paul Mundt |
5 | * Copyright (C) 2008, 2009 Matt Fleming | 5 | * Copyright (C) 2008, 2009 Matt Fleming |
6 | * | 6 | * |
7 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
@@ -86,13 +86,18 @@ | |||
86 | .type mcount,@function | 86 | .type mcount,@function |
87 | _mcount: | 87 | _mcount: |
88 | mcount: | 88 | mcount: |
89 | STACK_CHECK() | ||
90 | |||
91 | #ifndef CONFIG_FUNCTION_TRACER | ||
92 | rts | ||
93 | nop | ||
94 | #else | ||
89 | #ifndef CONFIG_DYNAMIC_FTRACE | 95 | #ifndef CONFIG_DYNAMIC_FTRACE |
90 | mov.l .Lfunction_trace_stop, r0 | 96 | mov.l .Lfunction_trace_stop, r0 |
91 | mov.l @r0, r0 | 97 | mov.l @r0, r0 |
92 | tst r0, r0 | 98 | tst r0, r0 |
93 | bf ftrace_stub | 99 | bf ftrace_stub |
94 | #endif | 100 | #endif |
95 | STACK_CHECK() | ||
96 | 101 | ||
97 | MCOUNT_ENTER() | 102 | MCOUNT_ENTER() |
98 | 103 | ||
@@ -174,8 +179,6 @@ ftrace_caller: | |||
174 | tst r0, r0 | 179 | tst r0, r0 |
175 | bf ftrace_stub | 180 | bf ftrace_stub |
176 | 181 | ||
177 | STACK_CHECK() | ||
178 | |||
179 | MCOUNT_ENTER() | 182 | MCOUNT_ENTER() |
180 | 183 | ||
181 | .globl ftrace_call | 184 | .globl ftrace_call |
@@ -211,38 +214,6 @@ ftrace_stub: | |||
211 | rts | 214 | rts |
212 | nop | 215 | nop |
213 | 216 | ||
214 | #ifdef CONFIG_STACK_DEBUG | ||
215 | .globl stack_panic | ||
216 | stack_panic: | ||
217 | mov.l .Ldump_stack, r0 | ||
218 | jsr @r0 | ||
219 | nop | ||
220 | |||
221 | mov.l .Lpanic, r0 | ||
222 | jsr @r0 | ||
223 | mov.l .Lpanic_s, r4 | ||
224 | |||
225 | rts | ||
226 | nop | ||
227 | |||
228 | .align 2 | ||
229 | .L_ebss: | ||
230 | .long _ebss | ||
231 | .L_init_thread_union: | ||
232 | .long init_thread_union | ||
233 | .Lpanic: | ||
234 | .long panic | ||
235 | .Lpanic_s: | ||
236 | .long .Lpanic_str | ||
237 | .Ldump_stack: | ||
238 | .long dump_stack | ||
239 | |||
240 | .section .rodata | ||
241 | .align 2 | ||
242 | .Lpanic_str: | ||
243 | .string "Stack error" | ||
244 | #endif /* CONFIG_STACK_DEBUG */ | ||
245 | |||
246 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 217 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
247 | .globl ftrace_graph_caller | 218 | .globl ftrace_graph_caller |
248 | ftrace_graph_caller: | 219 | ftrace_graph_caller: |
@@ -304,3 +275,36 @@ return_to_handler: | |||
304 | .Lftrace_return_to_handler: | 275 | .Lftrace_return_to_handler: |
305 | .long ftrace_return_to_handler | 276 | .long ftrace_return_to_handler |
306 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 277 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
278 | #endif /* CONFIG_FUNCTION_TRACER */ | ||
279 | |||
280 | #ifdef CONFIG_STACK_DEBUG | ||
281 | .globl stack_panic | ||
282 | stack_panic: | ||
283 | mov.l .Ldump_stack, r0 | ||
284 | jsr @r0 | ||
285 | nop | ||
286 | |||
287 | mov.l .Lpanic, r0 | ||
288 | jsr @r0 | ||
289 | mov.l .Lpanic_s, r4 | ||
290 | |||
291 | rts | ||
292 | nop | ||
293 | |||
294 | .align 2 | ||
295 | .L_ebss: | ||
296 | .long _ebss | ||
297 | .L_init_thread_union: | ||
298 | .long init_thread_union | ||
299 | .Lpanic: | ||
300 | .long panic | ||
301 | .Lpanic_s: | ||
302 | .long .Lpanic_str | ||
303 | .Ldump_stack: | ||
304 | .long dump_stack | ||
305 | |||
306 | .section .rodata | ||
307 | .align 2 | ||
308 | .Lpanic_str: | ||
309 | .string "Stack error" | ||
310 | #endif /* CONFIG_STACK_DEBUG */ | ||