1 #ifndef _LINUX_FTRACE_H
2 #define _LINUX_FTRACE_H
6 #include <linux/linkage.h>
9 extern int ftrace_enabled;
11 ftrace_enable_sysctl(struct ctl_table *table, int write,
12 struct file *filp, void __user *buffer, size_t *lenp,
15 typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
19 struct ftrace_ops *next;
23 * The ftrace_ops must be a static and should also
24 * be read_mostly. These functions do modify read_mostly variables
25 * so use them sparely. Never free an ftrace_op or modify the
26 * next pointer after it has been registered. Even after unregistering
27 * it, the next pointer may still be used internally.
29 int register_ftrace_function(struct ftrace_ops *ops);
30 int unregister_ftrace_function(struct ftrace_ops *ops);
31 void clear_ftrace_function(void);
33 extern void ftrace_stub(unsigned long a0, unsigned long a1);
35 #else /* !CONFIG_FTRACE */
36 # define register_ftrace_function(ops) do { } while (0)
37 # define unregister_ftrace_function(ops) do { } while (0)
38 # define clear_ftrace_function(ops) do { } while (0)
39 #endif /* CONFIG_FTRACE */
41 #ifdef CONFIG_DYNAMIC_FTRACE
42 # define FTRACE_HASHBITS 10
43 # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
46 FTRACE_FL_FREE = (1 << 0),
47 FTRACE_FL_FAILED = (1 << 1),
48 FTRACE_FL_FILTER = (1 << 2),
49 FTRACE_FL_ENABLED = (1 << 3),
50 FTRACE_FL_NOTRACE = (1 << 4),
51 FTRACE_FL_CONVERTED = (1 << 5),
52 FTRACE_FL_FROZEN = (1 << 6),
56 struct hlist_node node;
57 unsigned long ip; /* address of mcount call-site */
61 int ftrace_force_update(void);
62 void ftrace_set_filter(unsigned char *buf, int len, int reset);
65 extern int ftrace_ip_converted(unsigned long ip);
66 extern unsigned char *ftrace_nop_replace(void);
67 extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
68 extern int ftrace_dyn_arch_init(void *data);
69 extern int ftrace_mcount_set(unsigned long *data);
70 extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
71 unsigned char *new_code);
72 extern int ftrace_update_ftrace_func(ftrace_func_t func);
73 extern void ftrace_caller(void);
74 extern void ftrace_call(void);
75 extern void mcount_call(void);
77 extern int skip_trace(unsigned long ip);
79 void ftrace_disable_daemon(void);
80 void ftrace_enable_daemon(void);
83 # define skip_trace(ip) ({ 0; })
84 # define ftrace_force_update() ({ 0; })
85 # define ftrace_set_filter(buf, len, reset) do { } while (0)
86 # define ftrace_disable_daemon() do { } while (0)
87 # define ftrace_enable_daemon() do { } while (0)
88 #endif /* CONFIG_DYNAMIC_FTRACE */
90 /* totally disable ftrace - can not re-enable after this */
91 void ftrace_kill(void);
92 void ftrace_kill_atomic(void);
94 static inline void tracer_disable(void)
101 #ifdef CONFIG_FRAME_POINTER
102 /* TODO: need to fix this for ARM */
103 # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
104 # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
105 # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
106 # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
107 # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
108 # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
109 # define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
111 # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
112 # define CALLER_ADDR1 0UL
113 # define CALLER_ADDR2 0UL
114 # define CALLER_ADDR3 0UL
115 # define CALLER_ADDR4 0UL
116 # define CALLER_ADDR5 0UL
117 # define CALLER_ADDR6 0UL
120 #ifdef CONFIG_IRQSOFF_TRACER
121 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
122 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
124 # define time_hardirqs_on(a0, a1) do { } while (0)
125 # define time_hardirqs_off(a0, a1) do { } while (0)
128 #ifdef CONFIG_PREEMPT_TRACER
129 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
130 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
132 # define trace_preempt_on(a0, a1) do { } while (0)
133 # define trace_preempt_off(a0, a1) do { } while (0)
136 #ifdef CONFIG_TRACING
138 ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
141 ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
144 #endif /* _LINUX_FTRACE_H */