xref: /linux/tools/perf/util/perf-regs-arch/perf_regs_csky.c (revision 71dfa617ea9f18e4585fe78364217cd32b1fc382)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include "../perf_regs.h"
4 #include "../../arch/csky/include/uapi/asm/perf_regs.h"
5 
6 const char *__perf_reg_name_csky(int id)
7 {
8 	switch (id) {
9 	case PERF_REG_CSKY_A0:
10 		return "a0";
11 	case PERF_REG_CSKY_A1:
12 		return "a1";
13 	case PERF_REG_CSKY_A2:
14 		return "a2";
15 	case PERF_REG_CSKY_A3:
16 		return "a3";
17 	case PERF_REG_CSKY_REGS0:
18 		return "regs0";
19 	case PERF_REG_CSKY_REGS1:
20 		return "regs1";
21 	case PERF_REG_CSKY_REGS2:
22 		return "regs2";
23 	case PERF_REG_CSKY_REGS3:
24 		return "regs3";
25 	case PERF_REG_CSKY_REGS4:
26 		return "regs4";
27 	case PERF_REG_CSKY_REGS5:
28 		return "regs5";
29 	case PERF_REG_CSKY_REGS6:
30 		return "regs6";
31 	case PERF_REG_CSKY_REGS7:
32 		return "regs7";
33 	case PERF_REG_CSKY_REGS8:
34 		return "regs8";
35 	case PERF_REG_CSKY_REGS9:
36 		return "regs9";
37 	case PERF_REG_CSKY_SP:
38 		return "sp";
39 	case PERF_REG_CSKY_LR:
40 		return "lr";
41 	case PERF_REG_CSKY_PC:
42 		return "pc";
43 #if defined(__CSKYABIV2__)
44 	case PERF_REG_CSKY_EXREGS0:
45 		return "exregs0";
46 	case PERF_REG_CSKY_EXREGS1:
47 		return "exregs1";
48 	case PERF_REG_CSKY_EXREGS2:
49 		return "exregs2";
50 	case PERF_REG_CSKY_EXREGS3:
51 		return "exregs3";
52 	case PERF_REG_CSKY_EXREGS4:
53 		return "exregs4";
54 	case PERF_REG_CSKY_EXREGS5:
55 		return "exregs5";
56 	case PERF_REG_CSKY_EXREGS6:
57 		return "exregs6";
58 	case PERF_REG_CSKY_EXREGS7:
59 		return "exregs7";
60 	case PERF_REG_CSKY_EXREGS8:
61 		return "exregs8";
62 	case PERF_REG_CSKY_EXREGS9:
63 		return "exregs9";
64 	case PERF_REG_CSKY_EXREGS10:
65 		return "exregs10";
66 	case PERF_REG_CSKY_EXREGS11:
67 		return "exregs11";
68 	case PERF_REG_CSKY_EXREGS12:
69 		return "exregs12";
70 	case PERF_REG_CSKY_EXREGS13:
71 		return "exregs13";
72 	case PERF_REG_CSKY_EXREGS14:
73 		return "exregs14";
74 	case PERF_REG_CSKY_TLS:
75 		return "tls";
76 	case PERF_REG_CSKY_HI:
77 		return "hi";
78 	case PERF_REG_CSKY_LO:
79 		return "lo";
80 #endif
81 	default:
82 		return NULL;
83 	}
84 
85 	return NULL;
86 }
87 
88 uint64_t __perf_reg_ip_csky(void)
89 {
90 	return PERF_REG_CSKY_PC;
91 }
92 
93 uint64_t __perf_reg_sp_csky(void)
94 {
95 	return PERF_REG_CSKY_SP;
96 }
97