perf_regs.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef ARCH_PERF_REGS_H
  2. #define ARCH_PERF_REGS_H
  3. #include <stdlib.h>
  4. #include <linux/types.h>
  5. #include <asm/perf_regs.h>
  6. void perf_regs_load(u64 *regs);
  7. #define PERF_REGS_MASK ((1ULL << PERF_REG_ARM64_MAX) - 1)
  8. #define PERF_REGS_MAX PERF_REG_ARM64_MAX
  9. #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64
  10. #define PERF_REG_IP PERF_REG_ARM64_PC
  11. #define PERF_REG_SP PERF_REG_ARM64_SP
  12. static inline const char *perf_reg_name(int id)
  13. {
  14. switch (id) {
  15. case PERF_REG_ARM64_X0:
  16. return "x0";
  17. case PERF_REG_ARM64_X1:
  18. return "x1";
  19. case PERF_REG_ARM64_X2:
  20. return "x2";
  21. case PERF_REG_ARM64_X3:
  22. return "x3";
  23. case PERF_REG_ARM64_X4:
  24. return "x4";
  25. case PERF_REG_ARM64_X5:
  26. return "x5";
  27. case PERF_REG_ARM64_X6:
  28. return "x6";
  29. case PERF_REG_ARM64_X7:
  30. return "x7";
  31. case PERF_REG_ARM64_X8:
  32. return "x8";
  33. case PERF_REG_ARM64_X9:
  34. return "x9";
  35. case PERF_REG_ARM64_X10:
  36. return "x10";
  37. case PERF_REG_ARM64_X11:
  38. return "x11";
  39. case PERF_REG_ARM64_X12:
  40. return "x12";
  41. case PERF_REG_ARM64_X13:
  42. return "x13";
  43. case PERF_REG_ARM64_X14:
  44. return "x14";
  45. case PERF_REG_ARM64_X15:
  46. return "x15";
  47. case PERF_REG_ARM64_X16:
  48. return "x16";
  49. case PERF_REG_ARM64_X17:
  50. return "x17";
  51. case PERF_REG_ARM64_X18:
  52. return "x18";
  53. case PERF_REG_ARM64_X19:
  54. return "x19";
  55. case PERF_REG_ARM64_X20:
  56. return "x20";
  57. case PERF_REG_ARM64_X21:
  58. return "x21";
  59. case PERF_REG_ARM64_X22:
  60. return "x22";
  61. case PERF_REG_ARM64_X23:
  62. return "x23";
  63. case PERF_REG_ARM64_X24:
  64. return "x24";
  65. case PERF_REG_ARM64_X25:
  66. return "x25";
  67. case PERF_REG_ARM64_X26:
  68. return "x26";
  69. case PERF_REG_ARM64_X27:
  70. return "x27";
  71. case PERF_REG_ARM64_X28:
  72. return "x28";
  73. case PERF_REG_ARM64_X29:
  74. return "x29";
  75. case PERF_REG_ARM64_SP:
  76. return "sp";
  77. case PERF_REG_ARM64_LR:
  78. return "lr";
  79. case PERF_REG_ARM64_PC:
  80. return "pc";
  81. default:
  82. return NULL;
  83. }
  84. return NULL;
  85. }
  86. #endif /* ARCH_PERF_REGS_H */