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