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 #define PERF_REGS_MAX PERF_REG_MIPS_MAX 10 #define PERF_REG_IP PERF_REG_MIPS_PC 11 #define PERF_REG_SP PERF_REG_MIPS_R29 12 13 #define PERF_REGS_MASK ((1ULL << PERF_REG_MIPS_MAX) - 1) 14 15 static inline const char *__perf_reg_name(int id) 16 { 17 switch (id) { 18 case PERF_REG_MIPS_PC: 19 return "PC"; 20 case PERF_REG_MIPS_R1: 21 return "$1"; 22 case PERF_REG_MIPS_R2: 23 return "$2"; 24 case PERF_REG_MIPS_R3: 25 return "$3"; 26 case PERF_REG_MIPS_R4: 27 return "$4"; 28 case PERF_REG_MIPS_R5: 29 return "$5"; 30 case PERF_REG_MIPS_R6: 31 return "$6"; 32 case PERF_REG_MIPS_R7: 33 return "$7"; 34 case PERF_REG_MIPS_R8: 35 return "$8"; 36 case PERF_REG_MIPS_R9: 37 return "$9"; 38 case PERF_REG_MIPS_R10: 39 return "$10"; 40 case PERF_REG_MIPS_R11: 41 return "$11"; 42 case PERF_REG_MIPS_R12: 43 return "$12"; 44 case PERF_REG_MIPS_R13: 45 return "$13"; 46 case PERF_REG_MIPS_R14: 47 return "$14"; 48 case PERF_REG_MIPS_R15: 49 return "$15"; 50 case PERF_REG_MIPS_R16: 51 return "$16"; 52 case PERF_REG_MIPS_R17: 53 return "$17"; 54 case PERF_REG_MIPS_R18: 55 return "$18"; 56 case PERF_REG_MIPS_R19: 57 return "$19"; 58 case PERF_REG_MIPS_R20: 59 return "$20"; 60 case PERF_REG_MIPS_R21: 61 return "$21"; 62 case PERF_REG_MIPS_R22: 63 return "$22"; 64 case PERF_REG_MIPS_R23: 65 return "$23"; 66 case PERF_REG_MIPS_R24: 67 return "$24"; 68 case PERF_REG_MIPS_R25: 69 return "$25"; 70 case PERF_REG_MIPS_R28: 71 return "$28"; 72 case PERF_REG_MIPS_R29: 73 return "$29"; 74 case PERF_REG_MIPS_R30: 75 return "$30"; 76 case PERF_REG_MIPS_R31: 77 return "$31"; 78 default: 79 break; 80 } 81 return NULL; 82 } 83 84 #endif /* ARCH_PERF_REGS_H */ 85