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