11/ *
22 * arch/sh/lib/mcount.S
33 *
4- * Copyright (C) 2008 Paul Mundt
4+ * Copyright (C) 2008 , 2009 Paul Mundt
55 * Copyright (C) 2008 , 2009 Matt Fleming
66 *
77 * This file is subject to the terms and conditions of the GNU General Public
8686 .type mcount , @function
8787_mcount:
8888mcount:
89+ STACK_CHECK()
90+
91+ #ifndef CONFIG_FUNCTION_TRACER
92+ rts
93+ nop
94+ #else
8995#ifndef CONFIG_DYNAMIC_FTRACE
9096 mov .l .Lfunction_trace_stop , r0
9197 mov .l @r0 , r0
9298 tst r0 , r0
9399 bf ftrace_stub
94100#endif
95- STACK_CHECK()
96101
97102 MCOUNT_ENTER()
98103
@@ -174,8 +179,6 @@ ftrace_caller:
174179 tst r0 , r0
175180 bf ftrace_stub
176181
177- STACK_CHECK()
178-
179182 MCOUNT_ENTER()
180183
181184 .globl ftrace_call
@@ -192,14 +195,17 @@ ftrace_call:
192195#endif / * CONFIG_FUNCTION_GRAPH_TRACER * /
193196#endif / * CONFIG_DYNAMIC_FTRACE * /
194197
198+ . align 2
199+ .Lfunction_trace_stop:
200+ .long function_trace_stop
201+
195202/ *
196203 * NOTE: From here on the locations of the .Lftrace_stub label and
197204 * ftrace_stub itself are fixed. Adding additional data here will skew
198205 * the displacement for the memory table and break the block replacement.
199206 * Place new labels either after the ftrace_stub body , or before
200207 * ftrace_caller. You have been warned.
201208 * /
202- . align 2
203209.Lftrace_stub:
204210 .long ftrace_stub
205211
@@ -208,40 +214,6 @@ ftrace_stub:
208214 rts
209215 nop
210216
211- #ifdef CONFIG_STACK_DEBUG
212- .globl stack_panic
213- stack_panic:
214- mov .l .Ldump_stack , r0
215- jsr @r0
216- nop
217-
218- mov .l .Lpanic , r0
219- jsr @r0
220- mov .l .Lpanic_s , r4
221-
222- rts
223- nop
224-
225- . align 2
226- .Lfunction_trace_stop:
227- .long function_trace_stop
228- .L_ebss:
229- .long _ebss
230- .L_init_thread_union:
231- .long init_thread_union
232- .Lpanic:
233- .long panic
234- .Lpanic_s:
235- .long .Lpanic_str
236- .Ldump_stack:
237- .long dump_stack
238-
239- . section .rodata
240- . align 2
241- .Lpanic_str:
242- .string "Stack error"
243- #endif / * CONFIG_STACK_DEBUG * /
244-
245217#ifdef CONFIG_FUNCTION_GRAPH_TRACER
246218 .globl ftrace_graph_caller
247219ftrace_graph_caller:
@@ -303,3 +275,36 @@ return_to_handler:
303275.Lftrace_return_to_handler:
304276 .long ftrace_return_to_handler
305277#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 * /
0 commit comments