ftrace.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _LINUX_FTRACE_H
  2. #define _LINUX_FTRACE_H
  3. #ifdef CONFIG_FTRACE
  4. #include <linux/linkage.h>
  5. #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
  6. #define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
  7. #define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
  8. typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
  9. struct ftrace_ops {
  10. ftrace_func_t func;
  11. struct ftrace_ops *next;
  12. };
  13. /*
  14. * The ftrace_ops must be a static and should also
  15. * be read_mostly. These functions do modify read_mostly variables
  16. * so use them sparely. Never free an ftrace_op or modify the
  17. * next pointer after it has been registered. Even after unregistering
  18. * it, the next pointer may still be used internally.
  19. */
  20. int register_ftrace_function(struct ftrace_ops *ops);
  21. int unregister_ftrace_function(struct ftrace_ops *ops);
  22. void clear_ftrace_function(void);
  23. extern void ftrace_stub(unsigned long a0, unsigned long a1);
  24. extern void mcount(void);
  25. #else /* !CONFIG_FTRACE */
  26. # define register_ftrace_function(ops) do { } while (0)
  27. # define unregister_ftrace_function(ops) do { } while (0)
  28. # define clear_ftrace_function(ops) do { } while (0)
  29. #endif /* CONFIG_FTRACE */
  30. #endif /* _LINUX_FTRACE_H */