csky: Add support for perf unwind-libdw
[sfrench/cifs-2.6.git] / tools / perf / arch / csky / include / perf_regs.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
3
4 #ifndef ARCH_PERF_REGS_H
5 #define ARCH_PERF_REGS_H
6
7 #include <stdlib.h>
8 #include <linux/types.h>
9 #include <asm/perf_regs.h>
10
11 #define PERF_REGS_MASK  ((1ULL << PERF_REG_CSKY_MAX) - 1)
12 #define PERF_REGS_MAX   PERF_REG_CSKY_MAX
13 #define PERF_SAMPLE_REGS_ABI    PERF_SAMPLE_REGS_ABI_32
14
15 #define PERF_REG_IP     PERF_REG_CSKY_PC
16 #define PERF_REG_SP     PERF_REG_CSKY_SP
17
18 static inline const char *perf_reg_name(int id)
19 {
20         switch (id) {
21         case PERF_REG_CSKY_A0:
22                 return "a0";
23         case PERF_REG_CSKY_A1:
24                 return "a1";
25         case PERF_REG_CSKY_A2:
26                 return "a2";
27         case PERF_REG_CSKY_A3:
28                 return "a3";
29         case PERF_REG_CSKY_REGS0:
30                 return "regs0";
31         case PERF_REG_CSKY_REGS1:
32                 return "regs1";
33         case PERF_REG_CSKY_REGS2:
34                 return "regs2";
35         case PERF_REG_CSKY_REGS3:
36                 return "regs3";
37         case PERF_REG_CSKY_REGS4:
38                 return "regs4";
39         case PERF_REG_CSKY_REGS5:
40                 return "regs5";
41         case PERF_REG_CSKY_REGS6:
42                 return "regs6";
43         case PERF_REG_CSKY_REGS7:
44                 return "regs7";
45         case PERF_REG_CSKY_REGS8:
46                 return "regs8";
47         case PERF_REG_CSKY_REGS9:
48                 return "regs9";
49         case PERF_REG_CSKY_SP:
50                 return "sp";
51         case PERF_REG_CSKY_LR:
52                 return "lr";
53         case PERF_REG_CSKY_PC:
54                 return "pc";
55 #if defined(__CSKYABIV2__)
56         case PERF_REG_CSKY_EXREGS0:
57                 return "exregs0";
58         case PERF_REG_CSKY_EXREGS1:
59                 return "exregs1";
60         case PERF_REG_CSKY_EXREGS2:
61                 return "exregs2";
62         case PERF_REG_CSKY_EXREGS3:
63                 return "exregs3";
64         case PERF_REG_CSKY_EXREGS4:
65                 return "exregs4";
66         case PERF_REG_CSKY_EXREGS5:
67                 return "exregs5";
68         case PERF_REG_CSKY_EXREGS6:
69                 return "exregs6";
70         case PERF_REG_CSKY_EXREGS7:
71                 return "exregs7";
72         case PERF_REG_CSKY_EXREGS8:
73                 return "exregs8";
74         case PERF_REG_CSKY_EXREGS9:
75                 return "exregs9";
76         case PERF_REG_CSKY_EXREGS10:
77                 return "exregs10";
78         case PERF_REG_CSKY_EXREGS11:
79                 return "exregs11";
80         case PERF_REG_CSKY_EXREGS12:
81                 return "exregs12";
82         case PERF_REG_CSKY_EXREGS13:
83                 return "exregs13";
84         case PERF_REG_CSKY_EXREGS14:
85                 return "exregs14";
86         case PERF_REG_CSKY_TLS:
87                 return "tls";
88         case PERF_REG_CSKY_HI:
89                 return "hi";
90         case PERF_REG_CSKY_LO:
91                 return "lo";
92 #endif
93         default:
94                 return NULL;
95         }
96
97         return NULL;
98 }
99
100 #endif /* ARCH_PERF_REGS_H */