diff options
Diffstat (limited to 'arch/blackfin/kernel/ftrace.c')
-rw-r--r-- | arch/blackfin/kernel/ftrace.c | 42 |
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 000000000000..905bfc40a00b --- /dev/null +++ b/arch/blackfin/kernel/ftrace.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * ftrace graph code | ||
3 | * | ||
4 | * Copyright (C) 2009 Analog Devices Inc. | ||
5 | * Licensed under the GPL-2 or later. | ||
6 | */ | ||
7 | |||
8 | #include <linux/ftrace.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/sched.h> | ||
11 | #include <asm/atomic.h> | ||
12 | |||
13 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
14 | |||
15 | /* | ||
16 | * Hook the return address and push it in the stack of return addrs | ||
17 | * in current thread info. | ||
18 | */ | ||
19 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | ||
20 | { | ||
21 | struct ftrace_graph_ent trace; | ||
22 | unsigned long return_hooker = (unsigned long)&return_to_handler; | ||
23 | |||
24 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | ||
25 | return; | ||
26 | |||
27 | if (ftrace_push_return_trace(*parent, self_addr, &trace.depth) == -EBUSY) | ||
28 | return; | ||
29 | |||
30 | trace.func = self_addr; | ||
31 | |||
32 | /* Only trace if the calling function expects to */ | ||
33 | if (!ftrace_graph_entry(&trace)) { | ||
34 | current->curr_ret_stack--; | ||
35 | return; | ||
36 | } | ||
37 | |||
38 | /* all is well in the world ! hijack RETS ... */ | ||
39 | *parent = return_hooker; | ||
40 | } | ||
41 | |||
42 | #endif | ||