summaryrefslogtreecommitdiff
path: root/arch/blackfin/kernel/ftrace.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-06-10 08:45:29 (GMT)
committerMike Frysinger <vapier@gentoo.org>2009-06-13 11:20:16 (GMT)
commit1ee76d7e169ff2b0ff1df4b40b9d5276eec9ffb4 (patch)
tree384f296a2e24ee0156a81d9b62cdf6bc48d10650 /arch/blackfin/kernel/ftrace.c
parent1c873be744410e26fb91ee9228c90adff6eabe15 (diff)
downloadlinux-1ee76d7e169ff2b0ff1df4b40b9d5276eec9ffb4.tar.xz
Blackfin: initial support for ftrace grapher
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel/ftrace.c')
-rw-r--r--arch/blackfin/kernel/ftrace.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/blackfin/kernel/ftrace.c b/arch/blackfin/kernel/ftrace.c
new file mode 100644
index 0000000..905bfc4
--- /dev/null
+++ b/arch/blackfin/kernel/ftrace.c
@@ -0,0 +1,42 @@
+/*
+ * ftrace graph code
+ *
+ * Copyright (C) 2009 Analog Devices Inc.
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <linux/ftrace.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <asm/atomic.h>
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+
+/*
+ * Hook the return address and push it in the stack of return addrs
+ * in current thread info.
+ */
+void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
+{
+ struct ftrace_graph_ent trace;
+ unsigned long return_hooker = (unsigned long)&return_to_handler;
+
+ if (unlikely(atomic_read(&current->tracing_graph_pause)))
+ return;
+
+ if (ftrace_push_return_trace(*parent, self_addr, &trace.depth) == -EBUSY)
+ return;
+
+ trace.func = self_addr;
+
+ /* Only trace if the calling function expects to */
+ if (!ftrace_graph_entry(&trace)) {
+ current->curr_ret_stack--;
+ return;
+ }
+
+ /* all is well in the world ! hijack RETS ... */
+ *parent = return_hooker;
+}
+
+#endif