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_POWERPC_MAX) - 1) 12 #define PERF_REGS_MAX PERF_REG_POWERPC_MAX 13 #ifdef __powerpc64__ 14 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64 15 #else 16 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32 17 #endif 18 19 #define PERF_REG_IP PERF_REG_POWERPC_NIP 20 #define PERF_REG_SP PERF_REG_POWERPC_R1 21 22 static const char *reg_names[] = { 23 [PERF_REG_POWERPC_R0] = "r0", 24 [PERF_REG_POWERPC_R1] = "r1", 25 [PERF_REG_POWERPC_R2] = "r2", 26 [PERF_REG_POWERPC_R3] = "r3", 27 [PERF_REG_POWERPC_R4] = "r4", 28 [PERF_REG_POWERPC_R5] = "r5", 29 [PERF_REG_POWERPC_R6] = "r6", 30 [PERF_REG_POWERPC_R7] = "r7", 31 [PERF_REG_POWERPC_R8] = "r8", 32 [PERF_REG_POWERPC_R9] = "r9", 33 [PERF_REG_POWERPC_R10] = "r10", 34 [PERF_REG_POWERPC_R11] = "r11", 35 [PERF_REG_POWERPC_R12] = "r12", 36 [PERF_REG_POWERPC_R13] = "r13", 37 [PERF_REG_POWERPC_R14] = "r14", 38 [PERF_REG_POWERPC_R15] = "r15", 39 [PERF_REG_POWERPC_R16] = "r16", 40 [PERF_REG_POWERPC_R17] = "r17", 41 [PERF_REG_POWERPC_R18] = "r18", 42 [PERF_REG_POWERPC_R19] = "r19", 43 [PERF_REG_POWERPC_R20] = "r20", 44 [PERF_REG_POWERPC_R21] = "r21", 45 [PERF_REG_POWERPC_R22] = "r22", 46 [PERF_REG_POWERPC_R23] = "r23", 47 [PERF_REG_POWERPC_R24] = "r24", 48 [PERF_REG_POWERPC_R25] = "r25", 49 [PERF_REG_POWERPC_R26] = "r26", 50 [PERF_REG_POWERPC_R27] = "r27", 51 [PERF_REG_POWERPC_R28] = "r28", 52 [PERF_REG_POWERPC_R29] = "r29", 53 [PERF_REG_POWERPC_R30] = "r30", 54 [PERF_REG_POWERPC_R31] = "r31", 55 [PERF_REG_POWERPC_NIP] = "nip", 56 [PERF_REG_POWERPC_MSR] = "msr", 57 [PERF_REG_POWERPC_ORIG_R3] = "orig_r3", 58 [PERF_REG_POWERPC_CTR] = "ctr", 59 [PERF_REG_POWERPC_LINK] = "link", 60 [PERF_REG_POWERPC_XER] = "xer", 61 [PERF_REG_POWERPC_CCR] = "ccr", 62 [PERF_REG_POWERPC_SOFTE] = "softe", 63 [PERF_REG_POWERPC_TRAP] = "trap", 64 [PERF_REG_POWERPC_DAR] = "dar", 65 [PERF_REG_POWERPC_DSISR] = "dsisr", 66 [PERF_REG_POWERPC_SIER] = "sier", 67 [PERF_REG_POWERPC_MMCRA] = "mmcra", 68 [PERF_REG_POWERPC_MMCR0] = "mmcr0", 69 [PERF_REG_POWERPC_MMCR1] = "mmcr1", 70 [PERF_REG_POWERPC_MMCR2] = "mmcr2", 71 [PERF_REG_POWERPC_MMCR3] = "mmcr3", 72 [PERF_REG_POWERPC_SIER2] = "sier2", 73 [PERF_REG_POWERPC_SIER3] = "sier3", 74 }; 75 76 static inline const char *perf_reg_name(int id) 77 { 78 return reg_names[id]; 79 } 80 #endif /* ARCH_PERF_REGS_H */ 81