15000e7f6SLeo Yan // SPDX-License-Identifier: GPL-2.0 25000e7f6SLeo Yan 35000e7f6SLeo Yan #ifdef HAVE_PERF_REGS_SUPPORT 45000e7f6SLeo Yan 55000e7f6SLeo Yan #include "../perf_regs.h" 65000e7f6SLeo Yan #include "../../../arch/loongarch/include/uapi/asm/perf_regs.h" 75000e7f6SLeo Yan 85000e7f6SLeo Yan const char *__perf_reg_name_loongarch(int id) 95000e7f6SLeo Yan { 105000e7f6SLeo Yan switch (id) { 115000e7f6SLeo Yan case PERF_REG_LOONGARCH_PC: 125000e7f6SLeo Yan return "PC"; 135000e7f6SLeo Yan case PERF_REG_LOONGARCH_R1: 145000e7f6SLeo Yan return "%r1"; 155000e7f6SLeo Yan case PERF_REG_LOONGARCH_R2: 165000e7f6SLeo Yan return "%r2"; 175000e7f6SLeo Yan case PERF_REG_LOONGARCH_R3: 185000e7f6SLeo Yan return "%r3"; 195000e7f6SLeo Yan case PERF_REG_LOONGARCH_R4: 205000e7f6SLeo Yan return "%r4"; 215000e7f6SLeo Yan case PERF_REG_LOONGARCH_R5: 225000e7f6SLeo Yan return "%r5"; 235000e7f6SLeo Yan case PERF_REG_LOONGARCH_R6: 245000e7f6SLeo Yan return "%r6"; 255000e7f6SLeo Yan case PERF_REG_LOONGARCH_R7: 265000e7f6SLeo Yan return "%r7"; 275000e7f6SLeo Yan case PERF_REG_LOONGARCH_R8: 285000e7f6SLeo Yan return "%r8"; 295000e7f6SLeo Yan case PERF_REG_LOONGARCH_R9: 305000e7f6SLeo Yan return "%r9"; 315000e7f6SLeo Yan case PERF_REG_LOONGARCH_R10: 325000e7f6SLeo Yan return "%r10"; 335000e7f6SLeo Yan case PERF_REG_LOONGARCH_R11: 345000e7f6SLeo Yan return "%r11"; 355000e7f6SLeo Yan case PERF_REG_LOONGARCH_R12: 365000e7f6SLeo Yan return "%r12"; 375000e7f6SLeo Yan case PERF_REG_LOONGARCH_R13: 385000e7f6SLeo Yan return "%r13"; 395000e7f6SLeo Yan case PERF_REG_LOONGARCH_R14: 405000e7f6SLeo Yan return "%r14"; 415000e7f6SLeo Yan case PERF_REG_LOONGARCH_R15: 425000e7f6SLeo Yan return "%r15"; 435000e7f6SLeo Yan case PERF_REG_LOONGARCH_R16: 445000e7f6SLeo Yan return "%r16"; 455000e7f6SLeo Yan case PERF_REG_LOONGARCH_R17: 465000e7f6SLeo Yan return "%r17"; 475000e7f6SLeo Yan case PERF_REG_LOONGARCH_R18: 485000e7f6SLeo Yan return "%r18"; 495000e7f6SLeo Yan case PERF_REG_LOONGARCH_R19: 505000e7f6SLeo Yan return "%r19"; 515000e7f6SLeo Yan case PERF_REG_LOONGARCH_R20: 525000e7f6SLeo Yan return "%r20"; 535000e7f6SLeo Yan case PERF_REG_LOONGARCH_R21: 545000e7f6SLeo Yan return "%r21"; 555000e7f6SLeo Yan case PERF_REG_LOONGARCH_R22: 565000e7f6SLeo Yan return "%r22"; 575000e7f6SLeo Yan case PERF_REG_LOONGARCH_R23: 585000e7f6SLeo Yan return "%r23"; 595000e7f6SLeo Yan case PERF_REG_LOONGARCH_R24: 605000e7f6SLeo Yan return "%r24"; 615000e7f6SLeo Yan case PERF_REG_LOONGARCH_R25: 625000e7f6SLeo Yan return "%r25"; 635000e7f6SLeo Yan case PERF_REG_LOONGARCH_R26: 645000e7f6SLeo Yan return "%r26"; 655000e7f6SLeo Yan case PERF_REG_LOONGARCH_R27: 665000e7f6SLeo Yan return "%r27"; 675000e7f6SLeo Yan case PERF_REG_LOONGARCH_R28: 685000e7f6SLeo Yan return "%r28"; 695000e7f6SLeo Yan case PERF_REG_LOONGARCH_R29: 705000e7f6SLeo Yan return "%r29"; 715000e7f6SLeo Yan case PERF_REG_LOONGARCH_R30: 725000e7f6SLeo Yan return "%r30"; 735000e7f6SLeo Yan case PERF_REG_LOONGARCH_R31: 745000e7f6SLeo Yan return "%r31"; 755000e7f6SLeo Yan default: 765000e7f6SLeo Yan break; 775000e7f6SLeo Yan } 785000e7f6SLeo Yan return NULL; 795000e7f6SLeo Yan } 805000e7f6SLeo Yan 81*34af56afSLeo Yan uint64_t __perf_reg_ip_loongarch(void) 82*34af56afSLeo Yan { 83*34af56afSLeo Yan return PERF_REG_LOONGARCH_PC; 84*34af56afSLeo Yan } 85*34af56afSLeo Yan 86*34af56afSLeo Yan uint64_t __perf_reg_sp_loongarch(void) 87*34af56afSLeo Yan { 88*34af56afSLeo Yan return PERF_REG_LOONGARCH_R3; 89*34af56afSLeo Yan } 90*34af56afSLeo Yan 915000e7f6SLeo Yan #endif 92