ftrace.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. extern inline void *return_address(unsigned int level)
  37. {
  38. return NULL;
  39. }
  40. #endif
  41. #define HAVE_ARCH_CALLER_ADDR
  42. #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
  43. #define CALLER_ADDR1 ((unsigned long)return_address(1))
  44. #define CALLER_ADDR2 ((unsigned long)return_address(2))
  45. #define CALLER_ADDR3 ((unsigned long)return_address(3))
  46. #define CALLER_ADDR4 ((unsigned long)return_address(4))
  47. #define CALLER_ADDR5 ((unsigned long)return_address(5))
  48. #define CALLER_ADDR6 ((unsigned long)return_address(6))
  49. #endif /* ifndef __ASSEMBLY__ */
  50. #endif /* _ASM_ARM_FTRACE */