Arnaldo Carvalho de Melo | 16444a8 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_FTRACE_H |
| 2 | #define _LINUX_FTRACE_H |
| 3 | |
| 4 | #ifdef CONFIG_FTRACE |
| 5 | |
| 6 | #include <linux/linkage.h> |
| 7 | |
Arnaldo Carvalho de Melo | 16444a8 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 8 | typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); |
| 9 | |
| 10 | struct ftrace_ops { |
| 11 | ftrace_func_t func; |
| 12 | struct ftrace_ops *next; |
| 13 | }; |
| 14 | |
| 15 | /* |
| 16 | * The ftrace_ops must be a static and should also |
| 17 | * be read_mostly. These functions do modify read_mostly variables |
| 18 | * so use them sparely. Never free an ftrace_op or modify the |
| 19 | * next pointer after it has been registered. Even after unregistering |
| 20 | * it, the next pointer may still be used internally. |
| 21 | */ |
| 22 | int register_ftrace_function(struct ftrace_ops *ops); |
| 23 | int unregister_ftrace_function(struct ftrace_ops *ops); |
| 24 | void clear_ftrace_function(void); |
| 25 | |
| 26 | extern void ftrace_stub(unsigned long a0, unsigned long a1); |
| 27 | extern void mcount(void); |
| 28 | |
| 29 | #else /* !CONFIG_FTRACE */ |
| 30 | # define register_ftrace_function(ops) do { } while (0) |
| 31 | # define unregister_ftrace_function(ops) do { } while (0) |
| 32 | # define clear_ftrace_function(ops) do { } while (0) |
| 33 | #endif /* CONFIG_FTRACE */ |
Steven Rostedt | 352ad25 | 2008-05-12 21:20:42 +0200 | [diff] [blame^] | 34 | |
| 35 | |
| 36 | #ifdef CONFIG_FRAME_POINTER |
| 37 | /* TODO: need to fix this for ARM */ |
| 38 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
| 39 | # define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) |
| 40 | # define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) |
| 41 | # define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) |
| 42 | # define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) |
| 43 | # define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) |
| 44 | #else |
| 45 | # define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
| 46 | # define CALLER_ADDR1 0UL |
| 47 | # define CALLER_ADDR2 0UL |
| 48 | # define CALLER_ADDR3 0UL |
| 49 | # define CALLER_ADDR4 0UL |
| 50 | # define CALLER_ADDR5 0UL |
| 51 | #endif |
| 52 | |
Arnaldo Carvalho de Melo | 16444a8 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 53 | #endif /* _LINUX_FTRACE_H */ |