xref: /linux/tools/perf/util/perf-regs-arch/perf_regs_mips.c (revision 55ec81f7517fad09135f65552cea0a3ee84fff30)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #ifdef HAVE_PERF_REGS_SUPPORT
4 
5 #include "../perf_regs.h"
6 #include "../../../arch/mips/include/uapi/asm/perf_regs.h"
7 
8 const char *__perf_reg_name_mips(int id)
9 {
10 	switch (id) {
11 	case PERF_REG_MIPS_PC:
12 		return "PC";
13 	case PERF_REG_MIPS_R1:
14 		return "$1";
15 	case PERF_REG_MIPS_R2:
16 		return "$2";
17 	case PERF_REG_MIPS_R3:
18 		return "$3";
19 	case PERF_REG_MIPS_R4:
20 		return "$4";
21 	case PERF_REG_MIPS_R5:
22 		return "$5";
23 	case PERF_REG_MIPS_R6:
24 		return "$6";
25 	case PERF_REG_MIPS_R7:
26 		return "$7";
27 	case PERF_REG_MIPS_R8:
28 		return "$8";
29 	case PERF_REG_MIPS_R9:
30 		return "$9";
31 	case PERF_REG_MIPS_R10:
32 		return "$10";
33 	case PERF_REG_MIPS_R11:
34 		return "$11";
35 	case PERF_REG_MIPS_R12:
36 		return "$12";
37 	case PERF_REG_MIPS_R13:
38 		return "$13";
39 	case PERF_REG_MIPS_R14:
40 		return "$14";
41 	case PERF_REG_MIPS_R15:
42 		return "$15";
43 	case PERF_REG_MIPS_R16:
44 		return "$16";
45 	case PERF_REG_MIPS_R17:
46 		return "$17";
47 	case PERF_REG_MIPS_R18:
48 		return "$18";
49 	case PERF_REG_MIPS_R19:
50 		return "$19";
51 	case PERF_REG_MIPS_R20:
52 		return "$20";
53 	case PERF_REG_MIPS_R21:
54 		return "$21";
55 	case PERF_REG_MIPS_R22:
56 		return "$22";
57 	case PERF_REG_MIPS_R23:
58 		return "$23";
59 	case PERF_REG_MIPS_R24:
60 		return "$24";
61 	case PERF_REG_MIPS_R25:
62 		return "$25";
63 	case PERF_REG_MIPS_R28:
64 		return "$28";
65 	case PERF_REG_MIPS_R29:
66 		return "$29";
67 	case PERF_REG_MIPS_R30:
68 		return "$30";
69 	case PERF_REG_MIPS_R31:
70 		return "$31";
71 	default:
72 		break;
73 	}
74 	return NULL;
75 }
76 
77 uint64_t __perf_reg_ip_mips(void)
78 {
79 	return PERF_REG_MIPS_PC;
80 }
81 
82 uint64_t __perf_reg_sp_mips(void)
83 {
84 	return PERF_REG_MIPS_R29;
85 }
86 
87 #endif
88