ftrace.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef _ASM_X86_FTRACE_H
  2. #define _ASM_X86_FTRACE_H
  3. #ifdef CONFIG_FUNCTION_TRACER
  4. #define MCOUNT_ADDR ((long)(mcount))
  5. #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
  6. #ifndef __ASSEMBLY__
  7. extern void mcount(void);
  8. static inline unsigned long ftrace_call_adjust(unsigned long addr)
  9. {
  10. /*
  11. * call mcount is "e8 <4 byte offset>"
  12. * The addr points to the 4 byte offset and the caller of this
  13. * function wants the pointer to e8. Simply subtract one.
  14. */
  15. return addr - 1;
  16. }
  17. #ifdef CONFIG_DYNAMIC_FTRACE
  18. struct dyn_arch_ftrace {
  19. /* No extra data needed for x86 */
  20. };
  21. #endif /* CONFIG_DYNAMIC_FTRACE */
  22. #endif /* __ASSEMBLY__ */
  23. #endif /* CONFIG_FUNCTION_TRACER */
  24. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  25. #ifndef __ASSEMBLY__
  26. /*
  27. * Stack of return addresses for functions
  28. * of a thread.
  29. * Used in struct thread_info
  30. */
  31. struct ftrace_ret_stack {
  32. unsigned long ret;
  33. unsigned long func;
  34. unsigned long long calltime;
  35. };
  36. /*
  37. * Primary handler of a function return.
  38. * It relays on ftrace_return_to_handler.
  39. * Defined in entry32.S
  40. */
  41. extern void return_to_handler(void);
  42. #endif /* __ASSEMBLY__ */
  43. #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
  44. #endif /* _ASM_X86_FTRACE_H */