ftrace.h 1.9 KB

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