xref: /openbmc/linux/tools/perf/arch/sh/util/dwarf-regs.c (revision 2a598d0b)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Mapping of DWARF debug register numbers into register names.
4  *
5  * Copyright (C) 2010 Matt Fleming <matt@console-pimps.org>
6  */
7 
8 #include <stddef.h>
9 #include <dwarf-regs.h>
10 
11 /*
12  * Generic dwarf analysis helpers
13  */
14 
15 #define SH_MAX_REGS 18
16 const char *sh_regs_table[SH_MAX_REGS] = {
17 	"r0",
18 	"r1",
19 	"r2",
20 	"r3",
21 	"r4",
22 	"r5",
23 	"r6",
24 	"r7",
25 	"r8",
26 	"r9",
27 	"r10",
28 	"r11",
29 	"r12",
30 	"r13",
31 	"r14",
32 	"r15",
33 	"pc",
34 	"pr",
35 };
36 
37 /* Return architecture dependent register string (for kprobe-tracer) */
38 const char *get_arch_regstr(unsigned int n)
39 {
40 	return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL;
41 }
42