1 // SPDX-License-Identifier: GPL-2.0 2 3 #include "../perf_regs.h" 4 #include "../../../arch/loongarch/include/uapi/asm/perf_regs.h" 5 __perf_reg_name_loongarch(int id)6const char *__perf_reg_name_loongarch(int id) 7 { 8 switch (id) { 9 case PERF_REG_LOONGARCH_PC: 10 return "PC"; 11 case PERF_REG_LOONGARCH_R1: 12 return "%r1"; 13 case PERF_REG_LOONGARCH_R2: 14 return "%r2"; 15 case PERF_REG_LOONGARCH_R3: 16 return "%r3"; 17 case PERF_REG_LOONGARCH_R4: 18 return "%r4"; 19 case PERF_REG_LOONGARCH_R5: 20 return "%r5"; 21 case PERF_REG_LOONGARCH_R6: 22 return "%r6"; 23 case PERF_REG_LOONGARCH_R7: 24 return "%r7"; 25 case PERF_REG_LOONGARCH_R8: 26 return "%r8"; 27 case PERF_REG_LOONGARCH_R9: 28 return "%r9"; 29 case PERF_REG_LOONGARCH_R10: 30 return "%r10"; 31 case PERF_REG_LOONGARCH_R11: 32 return "%r11"; 33 case PERF_REG_LOONGARCH_R12: 34 return "%r12"; 35 case PERF_REG_LOONGARCH_R13: 36 return "%r13"; 37 case PERF_REG_LOONGARCH_R14: 38 return "%r14"; 39 case PERF_REG_LOONGARCH_R15: 40 return "%r15"; 41 case PERF_REG_LOONGARCH_R16: 42 return "%r16"; 43 case PERF_REG_LOONGARCH_R17: 44 return "%r17"; 45 case PERF_REG_LOONGARCH_R18: 46 return "%r18"; 47 case PERF_REG_LOONGARCH_R19: 48 return "%r19"; 49 case PERF_REG_LOONGARCH_R20: 50 return "%r20"; 51 case PERF_REG_LOONGARCH_R21: 52 return "%r21"; 53 case PERF_REG_LOONGARCH_R22: 54 return "%r22"; 55 case PERF_REG_LOONGARCH_R23: 56 return "%r23"; 57 case PERF_REG_LOONGARCH_R24: 58 return "%r24"; 59 case PERF_REG_LOONGARCH_R25: 60 return "%r25"; 61 case PERF_REG_LOONGARCH_R26: 62 return "%r26"; 63 case PERF_REG_LOONGARCH_R27: 64 return "%r27"; 65 case PERF_REG_LOONGARCH_R28: 66 return "%r28"; 67 case PERF_REG_LOONGARCH_R29: 68 return "%r29"; 69 case PERF_REG_LOONGARCH_R30: 70 return "%r30"; 71 case PERF_REG_LOONGARCH_R31: 72 return "%r31"; 73 default: 74 break; 75 } 76 return NULL; 77 } 78 __perf_reg_ip_loongarch(void)79uint64_t __perf_reg_ip_loongarch(void) 80 { 81 return PERF_REG_LOONGARCH_PC; 82 } 83 __perf_reg_sp_loongarch(void)84uint64_t __perf_reg_sp_loongarch(void) 85 { 86 return PERF_REG_LOONGARCH_R3; 87 } 88