ftrace.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * arch/xtensa/include/asm/ftrace.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2013 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_FTRACE_H
  11. #define _XTENSA_FTRACE_H
  12. #include <asm/processor.h>
  13. #define HAVE_ARCH_CALLER_ADDR
  14. #ifndef __ASSEMBLY__
  15. #define CALLER_ADDR0 ({ unsigned long a0, a1; \
  16. __asm__ __volatile__ ( \
  17. "mov %0, a0\n" \
  18. "mov %1, a1\n" \
  19. : "=r"(a0), "=r"(a1) : : ); \
  20. MAKE_PC_FROM_RA(a0, a1); })
  21. #ifdef CONFIG_FRAME_POINTER
  22. extern unsigned long return_address(unsigned level);
  23. #define CALLER_ADDR1 return_address(1)
  24. #define CALLER_ADDR2 return_address(2)
  25. #define CALLER_ADDR3 return_address(3)
  26. #else /* CONFIG_FRAME_POINTER */
  27. #define CALLER_ADDR1 (0)
  28. #define CALLER_ADDR2 (0)
  29. #define CALLER_ADDR3 (0)
  30. #endif /* CONFIG_FRAME_POINTER */
  31. #endif /* __ASSEMBLY__ */
  32. #ifdef CONFIG_FUNCTION_TRACER
  33. #define MCOUNT_ADDR ((unsigned long)(_mcount))
  34. #define MCOUNT_INSN_SIZE 3
  35. #ifndef __ASSEMBLY__
  36. extern void _mcount(void);
  37. #define mcount _mcount
  38. #endif /* __ASSEMBLY__ */
  39. #endif /* CONFIG_FUNCTION_TRACER */
  40. #endif /* _XTENSA_FTRACE_H */