aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/entry-common.S
diff options
context:
space:
mode:
authorTim Bird <tim.bird@am.sony.com>2010-10-09 12:54:38 -0400
committerRabin Vincent <rabin@rab.in>2010-11-19 11:13:27 -0500
commit376cfa8730c08c0394d0aa1d4a80fd8c9971f323 (patch)
treef1384eb77981241b1ab1028a50b94382c2c6e723 /arch/arm/kernel/entry-common.S
parentd3b9dc9dd2b994f396741f7086ffe7a48bacb165 (diff)
ARM: ftrace: function graph tracer support
Cc: Tim Bird <tim.bird@am.sony.com> [rabin@rab.in: rebase on top of latest code, keep code in ftrace.c instead of separate file, check for ftrace_graph_entry also] Signed-off-by: Rabin Vincent <rabin@rab.in>
Diffstat (limited to 'arch/arm/kernel/entry-common.S')
-rw-r--r--arch/arm/kernel/entry-common.S46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index fe1d5862b19f..9f1766211668 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -148,6 +148,20 @@ ENDPROC(ret_from_fork)
148 adr r0, .Lftrace_stub 148 adr r0, .Lftrace_stub
149 cmp r0, r2 149 cmp r0, r2
150 bne 1f 150 bne 1f
151
152#ifdef CONFIG_FUNCTION_GRAPH_TRACER
153 ldr r1, =ftrace_graph_return
154 ldr r2, [r1]
155 cmp r0, r2
156 bne ftrace_graph_caller\suffix
157
158 ldr r1, =ftrace_graph_entry
159 ldr r2, [r1]
160 ldr r0, =ftrace_graph_entry_stub
161 cmp r0, r2
162 bne ftrace_graph_caller\suffix
163#endif
164
151 mcount_exit 165 mcount_exit
152 166
1531: mcount_get_lr r1 @ lr of instrumented func 1671: mcount_get_lr r1 @ lr of instrumented func
@@ -172,6 +186,15 @@ ftrace_call\suffix:
172 mcount_exit 186 mcount_exit
173.endm 187.endm
174 188
189.macro __ftrace_graph_caller
190 sub r0, fp, #4 @ &lr of instrumented routine (&parent)
191 mov r1, lr @ instrumented routine (func)
192 sub r1, r1, #MCOUNT_INSN_SIZE
193 mov r2, fp @ frame pointer
194 bl prepare_ftrace_return
195 mcount_exit
196.endm
197
175#ifdef CONFIG_OLD_MCOUNT 198#ifdef CONFIG_OLD_MCOUNT
176/* 199/*
177 * mcount 200 * mcount
@@ -206,6 +229,12 @@ ENTRY(ftrace_caller_old)
206ENDPROC(ftrace_caller_old) 229ENDPROC(ftrace_caller_old)
207#endif 230#endif
208 231
232#ifdef CONFIG_FUNCTION_GRAPH_TRACER
233ENTRY(ftrace_graph_caller_old)
234 __ftrace_graph_caller
235ENDPROC(ftrace_graph_caller_old)
236#endif
237
209.purgem mcount_enter 238.purgem mcount_enter
210.purgem mcount_get_lr 239.purgem mcount_get_lr
211.purgem mcount_exit 240.purgem mcount_exit
@@ -244,10 +273,27 @@ ENTRY(ftrace_caller)
244ENDPROC(ftrace_caller) 273ENDPROC(ftrace_caller)
245#endif 274#endif
246 275
276#ifdef CONFIG_FUNCTION_GRAPH_TRACER
277ENTRY(ftrace_graph_caller)
278 __ftrace_graph_caller
279ENDPROC(ftrace_graph_caller)
280#endif
281
247.purgem mcount_enter 282.purgem mcount_enter
248.purgem mcount_get_lr 283.purgem mcount_get_lr
249.purgem mcount_exit 284.purgem mcount_exit
250 285
286#ifdef CONFIG_FUNCTION_GRAPH_TRACER
287 .globl return_to_handler
288return_to_handler:
289 stmdb sp!, {r0-r3}
290 mov r0, fp @ frame pointer
291 bl ftrace_return_to_handler
292 mov lr, r0 @ r0 has real ret addr
293 ldmia sp!, {r0-r3}
294 mov pc, lr
295#endif
296
251ENTRY(ftrace_stub) 297ENTRY(ftrace_stub)
252.Lftrace_stub: 298.Lftrace_stub:
253 mov pc, lr 299 mov pc, lr