ftrace.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_ARM_FTRACE
  3. #define _ASM_ARM_FTRACE
  4. #define HAVE_FUNCTION_GRAPH_FP_TEST
  5. #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
  6. #define ARCH_SUPPORTS_FTRACE_OPS 1
  7. #endif
  8. #ifdef CONFIG_FUNCTION_TRACER
  9. #define MCOUNT_ADDR ((unsigned long)(__gnu_mcount_nc))
  10. #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
  11. #ifndef __ASSEMBLY__
  12. extern void __gnu_mcount_nc(void);
  13. #ifdef CONFIG_DYNAMIC_FTRACE
  14. struct dyn_arch_ftrace {
  15. #ifdef CONFIG_ARM_MODULE_PLTS
  16. struct module *mod;
  17. #endif
  18. };
  19. static inline unsigned long ftrace_call_adjust(unsigned long addr)
  20. {
  21. /* With Thumb-2, the recorded addresses have the lsb set */
  22. return addr & ~1;
  23. }
  24. #endif
  25. #endif
  26. #endif
  27. #ifndef __ASSEMBLY__
  28. #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
  29. /*
  30. * return_address uses walk_stackframe to do it's work. If both
  31. * CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=y walk_stackframe uses unwind
  32. * information. For this to work in the function tracer many functions would
  33. * have to be marked with __notrace. So for now just depend on
  34. * !CONFIG_ARM_UNWIND.
  35. */
  36. void *return_address(unsigned int);
  37. #else
  38. static inline void *return_address(unsigned int level)
  39. {
  40. return NULL;
  41. }
  42. #endif
  43. #define ftrace_return_address(n) return_address(n)
  44. #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
  45. static inline bool arch_syscall_match_sym_name(const char *sym,
  46. const char *name)
  47. {
  48. if (!strcmp(sym, "sys_mmap2"))
  49. sym = "sys_mmap_pgoff";
  50. else if (!strcmp(sym, "sys_statfs64_wrapper"))
  51. sym = "sys_statfs64";
  52. else if (!strcmp(sym, "sys_fstatfs64_wrapper"))
  53. sym = "sys_fstatfs64";
  54. else if (!strcmp(sym, "sys_arm_fadvise64_64"))
  55. sym = "sys_fadvise64_64";
  56. /* Ignore case since sym may start with "SyS" instead of "sys" */
  57. return !strcasecmp(sym, name);
  58. }
  59. #endif /* ifndef __ASSEMBLY__ */
  60. #endif /* _ASM_ARM_FTRACE */