aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
new file mode 100644
index 000000000000..b96ef14c249a
--- /dev/null
+++ b/include/linux/ftrace.h
@@ -0,0 +1,38 @@
1#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H
3
4#ifdef CONFIG_FTRACE
5
6#include <linux/linkage.h>
7
8#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
9#define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
10#define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
11
12typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
13
14struct ftrace_ops {
15 ftrace_func_t func;
16 struct ftrace_ops *next;
17};
18
19/*
20 * The ftrace_ops must be a static and should also
21 * be read_mostly. These functions do modify read_mostly variables
22 * so use them sparely. Never free an ftrace_op or modify the
23 * next pointer after it has been registered. Even after unregistering
24 * it, the next pointer may still be used internally.
25 */
26int register_ftrace_function(struct ftrace_ops *ops);
27int unregister_ftrace_function(struct ftrace_ops *ops);
28void clear_ftrace_function(void);
29
30extern void ftrace_stub(unsigned long a0, unsigned long a1);
31extern void mcount(void);
32
33#else /* !CONFIG_FTRACE */
34# define register_ftrace_function(ops) do { } while (0)
35# define unregister_ftrace_function(ops) do { } while (0)
36# define clear_ftrace_function(ops) do { } while (0)
37#endif /* CONFIG_FTRACE */
38#endif /* _LINUX_FTRACE_H */