summaryrefslogtreecommitdiff
path: root/arch/arm/kernel/entry-common.S
diff options
context:
space:
mode:
authorTim Bird <tim.bird@am.sony.com>2010-10-09 22:24:38 +0530
committerRabin Vincent <rabin@rab.in>2010-11-19 21:43:27 +0530
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)
adr r0, .Lftrace_stub
cmp r0, r2
bne 1f
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ ldr r1, =ftrace_graph_return
+ ldr r2, [r1]
+ cmp r0, r2
+ bne ftrace_graph_caller\suffix
+
+ ldr r1, =ftrace_graph_entry
+ ldr r2, [r1]
+ ldr r0, =ftrace_graph_entry_stub
+ cmp r0, r2
+ bne ftrace_graph_caller\suffix
+#endif
+
mcount_exit
1: mcount_get_lr r1 @ lr of instrumented func
@@ -172,6 +186,15 @@ ftrace_call\suffix:
mcount_exit
.endm
+.macro __ftrace_graph_caller
+ sub r0, fp, #4 @ &lr of instrumented routine (&parent)
+ mov r1, lr @ instrumented routine (func)
+ sub r1, r1, #MCOUNT_INSN_SIZE
+ mov r2, fp @ frame pointer
+ bl prepare_ftrace_return
+ mcount_exit
+.endm
+
#ifdef CONFIG_OLD_MCOUNT
/*
* mcount
@@ -206,6 +229,12 @@ ENTRY(ftrace_caller_old)
ENDPROC(ftrace_caller_old)
#endif
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ENTRY(ftrace_graph_caller_old)
+ __ftrace_graph_caller
+ENDPROC(ftrace_graph_caller_old)
+#endif
+
.purgem mcount_enter
.purgem mcount_get_lr
.purgem mcount_exit
@@ -244,10 +273,27 @@ ENTRY(ftrace_caller)
ENDPROC(ftrace_caller)
#endif
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ENTRY(ftrace_graph_caller)
+ __ftrace_graph_caller
+ENDPROC(ftrace_graph_caller)
+#endif
+
.purgem mcount_enter
.purgem mcount_get_lr
.purgem mcount_exit
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ .globl return_to_handler
+return_to_handler:
+ stmdb sp!, {r0-r3}
+ mov r0, fp @ frame pointer
+ bl ftrace_return_to_handler
+ mov lr, r0 @ r0 has real ret addr
+ ldmia sp!, {r0-r3}
+ mov pc, lr
+#endif
+
ENTRY(ftrace_stub)
.Lftrace_stub:
mov pc, lr