unwind-libunwind.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <errno.h>
  3. #ifndef REMOTE_UNWIND_LIBUNWIND
  4. #include <libunwind.h>
  5. #include "perf_regs.h"
  6. #include "../../util/unwind.h"
  7. #include "../../util/debug.h"
  8. #endif
  9. int LIBUNWIND__ARCH_REG_ID(int regnum)
  10. {
  11. switch (regnum) {
  12. case UNW_AARCH64_X0:
  13. return PERF_REG_ARM64_X0;
  14. case UNW_AARCH64_X1:
  15. return PERF_REG_ARM64_X1;
  16. case UNW_AARCH64_X2:
  17. return PERF_REG_ARM64_X2;
  18. case UNW_AARCH64_X3:
  19. return PERF_REG_ARM64_X3;
  20. case UNW_AARCH64_X4:
  21. return PERF_REG_ARM64_X4;
  22. case UNW_AARCH64_X5:
  23. return PERF_REG_ARM64_X5;
  24. case UNW_AARCH64_X6:
  25. return PERF_REG_ARM64_X6;
  26. case UNW_AARCH64_X7:
  27. return PERF_REG_ARM64_X7;
  28. case UNW_AARCH64_X8:
  29. return PERF_REG_ARM64_X8;
  30. case UNW_AARCH64_X9:
  31. return PERF_REG_ARM64_X9;
  32. case UNW_AARCH64_X10:
  33. return PERF_REG_ARM64_X10;
  34. case UNW_AARCH64_X11:
  35. return PERF_REG_ARM64_X11;
  36. case UNW_AARCH64_X12:
  37. return PERF_REG_ARM64_X12;
  38. case UNW_AARCH64_X13:
  39. return PERF_REG_ARM64_X13;
  40. case UNW_AARCH64_X14:
  41. return PERF_REG_ARM64_X14;
  42. case UNW_AARCH64_X15:
  43. return PERF_REG_ARM64_X15;
  44. case UNW_AARCH64_X16:
  45. return PERF_REG_ARM64_X16;
  46. case UNW_AARCH64_X17:
  47. return PERF_REG_ARM64_X17;
  48. case UNW_AARCH64_X18:
  49. return PERF_REG_ARM64_X18;
  50. case UNW_AARCH64_X19:
  51. return PERF_REG_ARM64_X19;
  52. case UNW_AARCH64_X20:
  53. return PERF_REG_ARM64_X20;
  54. case UNW_AARCH64_X21:
  55. return PERF_REG_ARM64_X21;
  56. case UNW_AARCH64_X22:
  57. return PERF_REG_ARM64_X22;
  58. case UNW_AARCH64_X23:
  59. return PERF_REG_ARM64_X23;
  60. case UNW_AARCH64_X24:
  61. return PERF_REG_ARM64_X24;
  62. case UNW_AARCH64_X25:
  63. return PERF_REG_ARM64_X25;
  64. case UNW_AARCH64_X26:
  65. return PERF_REG_ARM64_X26;
  66. case UNW_AARCH64_X27:
  67. return PERF_REG_ARM64_X27;
  68. case UNW_AARCH64_X28:
  69. return PERF_REG_ARM64_X28;
  70. case UNW_AARCH64_X29:
  71. return PERF_REG_ARM64_X29;
  72. case UNW_AARCH64_X30:
  73. return PERF_REG_ARM64_LR;
  74. case UNW_AARCH64_SP:
  75. return PERF_REG_ARM64_SP;
  76. case UNW_AARCH64_PC:
  77. return PERF_REG_ARM64_PC;
  78. default:
  79. pr_err("unwind: invalid reg id %d\n", regnum);
  80. return -EINVAL;
  81. }
  82. return -EINVAL;
  83. }