Commit | Line | Data |
---|---|---|
16444a8a ACM |
1 | #ifndef _LINUX_FTRACE_H |
2 | #define _LINUX_FTRACE_H | |
3 | ||
4 | #ifdef CONFIG_FTRACE | |
5 | ||
6 | #include <linux/linkage.h> | |
7 | ||
b0fc494f SR |
8 | extern int ftrace_enabled; |
9 | extern int | |
10 | ftrace_enable_sysctl(struct ctl_table *table, int write, | |
11 | struct file *filp, void __user *buffer, size_t *lenp, | |
12 | loff_t *ppos); | |
13 | ||
16444a8a ACM |
14 | typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); |
15 | ||
16 | struct ftrace_ops { | |
17 | ftrace_func_t func; | |
18 | struct ftrace_ops *next; | |
19 | }; | |
20 | ||
21 | /* | |
22 | * The ftrace_ops must be a static and should also | |
23 | * be read_mostly. These functions do modify read_mostly variables | |
24 | * so use them sparely. Never free an ftrace_op or modify the | |
25 | * next pointer after it has been registered. Even after unregistering | |
26 | * it, the next pointer may still be used internally. | |
27 | */ | |
28 | int register_ftrace_function(struct ftrace_ops *ops); | |
29 | int unregister_ftrace_function(struct ftrace_ops *ops); | |
30 | void clear_ftrace_function(void); | |
31 | ||
32 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | |
33 | extern void mcount(void); | |
34 | ||
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 */ | |
352ad25a | 40 | |
3d083395 SR |
41 | #ifdef CONFIG_DYNAMIC_FTRACE |
42 | # define FTRACE_HASHBITS 10 | |
43 | # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS) | |
44 | ||
45 | struct dyn_ftrace { | |
46 | struct hlist_node node; | |
47 | unsigned long ip; | |
48 | }; | |
49 | ||
50 | /* defined in arch */ | |
51 | extern struct dyn_ftrace * | |
52 | ftrace_alloc_shutdown_node(unsigned long ip); | |
53 | extern int ftrace_shutdown_arch_init(void); | |
54 | extern void ftrace_code_disable(struct dyn_ftrace *rec); | |
55 | extern void ftrace_startup_code(void); | |
56 | extern void ftrace_shutdown_code(void); | |
57 | extern void ftrace_shutdown_replenish(void); | |
58 | #endif | |
352ad25a SR |
59 | |
60 | #ifdef CONFIG_FRAME_POINTER | |
61 | /* TODO: need to fix this for ARM */ | |
62 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | |
63 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) | |
64 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) | |
65 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) | |
66 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) | |
67 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) | |
68 | #else | |
69 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | |
70 | # define CALLER_ADDR1 0UL | |
71 | # define CALLER_ADDR2 0UL | |
72 | # define CALLER_ADDR3 0UL | |
73 | # define CALLER_ADDR4 0UL | |
74 | # define CALLER_ADDR5 0UL | |
75 | #endif | |
76 | ||
81d68a96 SR |
77 | #ifdef CONFIG_IRQSOFF_TRACER |
78 | extern void notrace time_hardirqs_on(unsigned long a0, unsigned long a1); | |
79 | extern void notrace time_hardirqs_off(unsigned long a0, unsigned long a1); | |
80 | #else | |
81 | # define time_hardirqs_on(a0, a1) do { } while (0) | |
82 | # define time_hardirqs_off(a0, a1) do { } while (0) | |
83 | #endif | |
84 | ||
6cd8a4bb SR |
85 | #ifdef CONFIG_PREEMPT_TRACER |
86 | extern void notrace trace_preempt_on(unsigned long a0, unsigned long a1); | |
87 | extern void notrace trace_preempt_off(unsigned long a0, unsigned long a1); | |
88 | #else | |
89 | # define trace_preempt_on(a0, a1) do { } while (0) | |
90 | # define trace_preempt_off(a0, a1) do { } while (0) | |
91 | #endif | |
92 | ||
16444a8a | 93 | #endif /* _LINUX_FTRACE_H */ |