ftrace.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_RET_TRACER
  25. #define FTRACE_RET_STACK_SIZE 20
  26. #ifndef __ASSEMBLY__
  27. /*
  28. * Stack of return addresses for functions
  29. * of a thread.
  30. * Used in struct thread_info
  31. */
  32. struct ftrace_ret_stack {
  33. unsigned long ret;
  34. unsigned long func;
  35. unsigned long long calltime;
  36. };
  37. /*
  38. * Primary handler of a function return.
  39. * It relays on ftrace_return_to_handler.
  40. * Defined in entry32.S
  41. */
  42. extern void return_to_handler(void);
  43. #endif /* __ASSEMBLY__ */
  44. #endif /* CONFIG_FUNCTION_RET_TRACER */
  45. #endif /* _ASM_X86_FTRACE_H */