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