perf_regs.h 1.9 KB

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