xref: /linux/tools/perf/arch/arm/include/perf_regs.h (revision 172cdcaefea5c297fdb3d20b7d5aff60ae4fbce6)
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_ARM_MAX) - 1)
12 #define PERF_REGS_MAX	PERF_REG_ARM_MAX
13 #define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_32
14 
15 #define PERF_REG_IP	PERF_REG_ARM_PC
16 #define PERF_REG_SP	PERF_REG_ARM_SP
17 
18 static inline const char *__perf_reg_name(int id)
19 {
20 	switch (id) {
21 	case PERF_REG_ARM_R0:
22 		return "r0";
23 	case PERF_REG_ARM_R1:
24 		return "r1";
25 	case PERF_REG_ARM_R2:
26 		return "r2";
27 	case PERF_REG_ARM_R3:
28 		return "r3";
29 	case PERF_REG_ARM_R4:
30 		return "r4";
31 	case PERF_REG_ARM_R5:
32 		return "r5";
33 	case PERF_REG_ARM_R6:
34 		return "r6";
35 	case PERF_REG_ARM_R7:
36 		return "r7";
37 	case PERF_REG_ARM_R8:
38 		return "r8";
39 	case PERF_REG_ARM_R9:
40 		return "r9";
41 	case PERF_REG_ARM_R10:
42 		return "r10";
43 	case PERF_REG_ARM_FP:
44 		return "fp";
45 	case PERF_REG_ARM_IP:
46 		return "ip";
47 	case PERF_REG_ARM_SP:
48 		return "sp";
49 	case PERF_REG_ARM_LR:
50 		return "lr";
51 	case PERF_REG_ARM_PC:
52 		return "pc";
53 	default:
54 		return NULL;
55 	}
56 
57 	return NULL;
58 }
59 
60 #endif /* ARCH_PERF_REGS_H */
61