12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
21fa6ac37SDavid S. Miller /*
31fa6ac37SDavid S. Miller  * Mapping of DWARF debug register numbers into register names.
41fa6ac37SDavid S. Miller  *
51fa6ac37SDavid S. Miller  * Copyright (C) 2010 David S. Miller <davem@davemloft.net>
61fa6ac37SDavid S. Miller  */
71fa6ac37SDavid S. Miller 
8861e10beSCody P Schafer #include <stddef.h>
91fa6ac37SDavid S. Miller #include <dwarf-regs.h>
101fa6ac37SDavid S. Miller 
111fa6ac37SDavid S. Miller #define SPARC_MAX_REGS	96
121fa6ac37SDavid S. Miller 
131fa6ac37SDavid S. Miller const char *sparc_regs_table[SPARC_MAX_REGS] = {
141fa6ac37SDavid S. Miller 	"%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7",
151fa6ac37SDavid S. Miller 	"%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7",
161fa6ac37SDavid S. Miller 	"%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7",
171fa6ac37SDavid S. Miller 	"%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7",
181fa6ac37SDavid S. Miller 	"%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
191fa6ac37SDavid S. Miller 	"%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
201fa6ac37SDavid S. Miller 	"%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
211fa6ac37SDavid S. Miller 	"%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
221fa6ac37SDavid S. Miller 	"%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39",
231fa6ac37SDavid S. Miller 	"%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47",
241fa6ac37SDavid S. Miller 	"%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55",
251fa6ac37SDavid S. Miller 	"%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63",
261fa6ac37SDavid S. Miller };
271fa6ac37SDavid S. Miller 
281fa6ac37SDavid S. Miller /**
291fa6ac37SDavid S. Miller  * get_arch_regstr() - lookup register name from it's DWARF register number
301fa6ac37SDavid S. Miller  * @n:	the DWARF register number
311fa6ac37SDavid S. Miller  *
321fa6ac37SDavid S. Miller  * get_arch_regstr() returns the name of the register in struct
331fa6ac37SDavid S. Miller  * regdwarfnum_table from it's DWARF register number. If the register is not
341fa6ac37SDavid S. Miller  * found in the table, this returns NULL;
351fa6ac37SDavid S. Miller  */
get_arch_regstr(unsigned int n)361fa6ac37SDavid S. Miller const char *get_arch_regstr(unsigned int n)
371fa6ac37SDavid S. Miller {
383b27d139SWang Nan 	return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
391fa6ac37SDavid S. Miller }
40