ftrace.h 1.7 KB

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