1 #ifndef ARCH_PERF_REGS_H
2 #define ARCH_PERF_REGS_H
3 
4 #include <stdlib.h>
5 #include <linux/types.h>
6 #include <asm/perf_regs.h>
7 
8 #define PERF_REGS_MASK  ((1ULL << PERF_REG_POWERPC_MAX) - 1)
9 #define PERF_REGS_MAX   PERF_REG_POWERPC_MAX
10 #ifdef __powerpc64__
11 	#define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_64
12 #else
13 	#define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_32
14 #endif
15 
16 #define PERF_REG_IP     PERF_REG_POWERPC_NIP
17 #define PERF_REG_SP     PERF_REG_POWERPC_R1
18 
19 static const char *reg_names[] = {
20 	[PERF_REG_POWERPC_R0] = "r0",
21 	[PERF_REG_POWERPC_R1] = "r1",
22 	[PERF_REG_POWERPC_R2] = "r2",
23 	[PERF_REG_POWERPC_R3] = "r3",
24 	[PERF_REG_POWERPC_R4] = "r4",
25 	[PERF_REG_POWERPC_R5] = "r5",
26 	[PERF_REG_POWERPC_R6] = "r6",
27 	[PERF_REG_POWERPC_R7] = "r7",
28 	[PERF_REG_POWERPC_R8] = "r8",
29 	[PERF_REG_POWERPC_R9] = "r9",
30 	[PERF_REG_POWERPC_R10] = "r10",
31 	[PERF_REG_POWERPC_R11] = "r11",
32 	[PERF_REG_POWERPC_R12] = "r12",
33 	[PERF_REG_POWERPC_R13] = "r13",
34 	[PERF_REG_POWERPC_R14] = "r14",
35 	[PERF_REG_POWERPC_R15] = "r15",
36 	[PERF_REG_POWERPC_R16] = "r16",
37 	[PERF_REG_POWERPC_R17] = "r17",
38 	[PERF_REG_POWERPC_R18] = "r18",
39 	[PERF_REG_POWERPC_R19] = "r19",
40 	[PERF_REG_POWERPC_R20] = "r20",
41 	[PERF_REG_POWERPC_R21] = "r21",
42 	[PERF_REG_POWERPC_R22] = "r22",
43 	[PERF_REG_POWERPC_R23] = "r23",
44 	[PERF_REG_POWERPC_R24] = "r24",
45 	[PERF_REG_POWERPC_R25] = "r25",
46 	[PERF_REG_POWERPC_R26] = "r26",
47 	[PERF_REG_POWERPC_R27] = "r27",
48 	[PERF_REG_POWERPC_R28] = "r28",
49 	[PERF_REG_POWERPC_R29] = "r29",
50 	[PERF_REG_POWERPC_R30] = "r30",
51 	[PERF_REG_POWERPC_R31] = "r31",
52 	[PERF_REG_POWERPC_NIP] = "nip",
53 	[PERF_REG_POWERPC_MSR] = "msr",
54 	[PERF_REG_POWERPC_ORIG_R3] = "orig_r3",
55 	[PERF_REG_POWERPC_CTR] = "ctr",
56 	[PERF_REG_POWERPC_LINK] = "link",
57 	[PERF_REG_POWERPC_XER] = "xer",
58 	[PERF_REG_POWERPC_CCR] = "ccr",
59 	[PERF_REG_POWERPC_SOFTE] = "softe",
60 	[PERF_REG_POWERPC_TRAP] = "trap",
61 	[PERF_REG_POWERPC_DAR] = "dar",
62 	[PERF_REG_POWERPC_DSISR] = "dsisr"
63 };
64 
65 static inline const char *perf_reg_name(int id)
66 {
67 	return reg_names[id];
68 }
69 #endif /* ARCH_PERF_REGS_H */
70