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