ftrace.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _ASM_X86_FTRACE_H
  2. #define _ASM_X86_FTRACE_H
  3. #ifdef CONFIG_FUNCTION_TRACER
  4. #ifdef CC_USING_FENTRY
  5. # define MCOUNT_ADDR ((unsigned long)(__fentry__))
  6. #else
  7. # define MCOUNT_ADDR ((unsigned long)(mcount))
  8. # define HAVE_FUNCTION_GRAPH_FP_TEST
  9. #endif
  10. #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
  11. #ifdef CONFIG_DYNAMIC_FTRACE
  12. #define ARCH_SUPPORTS_FTRACE_OPS 1
  13. #endif
  14. #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
  15. #ifndef __ASSEMBLY__
  16. extern void mcount(void);
  17. extern atomic_t modifying_ftrace_code;
  18. extern void __fentry__(void);
  19. static inline unsigned long ftrace_call_adjust(unsigned long addr)
  20. {
  21. /*
  22. * addr is the address of the mcount call instruction.
  23. * recordmcount does the necessary offset calculation.
  24. */
  25. return addr;
  26. }
  27. #ifdef CONFIG_DYNAMIC_FTRACE
  28. struct dyn_arch_ftrace {
  29. /* No extra data needed for x86 */
  30. };
  31. int ftrace_int3_handler(struct pt_regs *regs);
  32. #define FTRACE_GRAPH_TRAMP_ADDR FTRACE_GRAPH_ADDR
  33. #endif /* CONFIG_DYNAMIC_FTRACE */
  34. #endif /* __ASSEMBLY__ */
  35. #endif /* CONFIG_FUNCTION_TRACER */
  36. #if !defined(__ASSEMBLY__) && !defined(COMPILE_OFFSETS)
  37. #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
  38. #include <asm/compat.h>
  39. /*
  40. * Because ia32 syscalls do not map to x86_64 syscall numbers
  41. * this screws up the trace output when tracing a ia32 task.
  42. * Instead of reporting bogus syscalls, just do not trace them.
  43. *
  44. * If the user really wants these, then they should use the
  45. * raw syscall tracepoints with filtering.
  46. */
  47. #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1
  48. static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
  49. {
  50. if (in_compat_syscall())
  51. return true;
  52. return false;
  53. }
  54. #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
  55. #endif /* !__ASSEMBLY__ && !COMPILE_OFFSETS */
  56. #endif /* _ASM_X86_FTRACE_H */