ftrace.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef _ASM_POWERPC_FTRACE
  2. #define _ASM_POWERPC_FTRACE
  3. #include <asm/types.h>
  4. #ifdef CONFIG_FUNCTION_TRACER
  5. #define MCOUNT_ADDR ((unsigned long)(_mcount))
  6. #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
  7. #ifdef __ASSEMBLY__
  8. /* Based off of objdump optput from glibc */
  9. #define MCOUNT_SAVE_FRAME \
  10. stwu r1,-48(r1); \
  11. stw r3, 12(r1); \
  12. stw r4, 16(r1); \
  13. stw r5, 20(r1); \
  14. stw r6, 24(r1); \
  15. mflr r3; \
  16. lwz r4, 52(r1); \
  17. mfcr r5; \
  18. stw r7, 28(r1); \
  19. stw r8, 32(r1); \
  20. stw r9, 36(r1); \
  21. stw r10,40(r1); \
  22. stw r3, 44(r1); \
  23. stw r5, 8(r1)
  24. #define MCOUNT_RESTORE_FRAME \
  25. lwz r6, 8(r1); \
  26. lwz r0, 44(r1); \
  27. lwz r3, 12(r1); \
  28. mtctr r0; \
  29. lwz r4, 16(r1); \
  30. mtcr r6; \
  31. lwz r5, 20(r1); \
  32. lwz r6, 24(r1); \
  33. lwz r0, 52(r1); \
  34. lwz r7, 28(r1); \
  35. lwz r8, 32(r1); \
  36. mtlr r0; \
  37. lwz r9, 36(r1); \
  38. lwz r10,40(r1); \
  39. addi r1, r1, 48
  40. #else /* !__ASSEMBLY__ */
  41. extern void _mcount(void);
  42. #ifdef CONFIG_DYNAMIC_FTRACE
  43. # define FTRACE_ADDR ((unsigned long)ftrace_caller)
  44. # define FTRACE_REGS_ADDR FTRACE_ADDR
  45. static inline unsigned long ftrace_call_adjust(unsigned long addr)
  46. {
  47. /* reloction of mcount call site is the same as the address */
  48. return addr;
  49. }
  50. struct dyn_arch_ftrace {
  51. struct module *mod;
  52. };
  53. #endif /* CONFIG_DYNAMIC_FTRACE */
  54. #endif /* __ASSEMBLY__ */
  55. #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
  56. #define ARCH_SUPPORTS_FTRACE_OPS 1
  57. #endif
  58. #endif
  59. #if defined(CONFIG_FTRACE_SYSCALLS) && !defined(__ASSEMBLY__)
  60. #ifdef PPC64_ELF_ABI_v1
  61. #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
  62. static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
  63. {
  64. /*
  65. * Compare the symbol name with the system call name. Skip the .sys or .SyS
  66. * prefix from the symbol name and the sys prefix from the system call name and
  67. * just match the rest. This is only needed on ppc64 since symbol names on
  68. * 32bit do not start with a period so the generic function will work.
  69. */
  70. return !strcmp(sym + 4, name + 3);
  71. }
  72. #endif
  73. #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
  74. #endif /* _ASM_POWERPC_FTRACE */