Initial import
[external/libunwind.git] / src / ppc32 / regname.c
1 /* libunwind - a platform-independent unwind library
2    Copyright (C) 2006-2007 IBM
3    Contributed by
4      Corey Ashford <cjashfor@us.ibm.com>
5      Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
6
7 This file is part of libunwind.
8
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice shall be
18 included in all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
27
28 #include "unwind_i.h"
29
30 static const char *regname[] =
31   {
32     [UNW_PPC32_R0]="GPR0",
33     [UNW_PPC32_R1]="GPR1",
34     [UNW_PPC32_R2]="GPR2",
35     [UNW_PPC32_R3]="GPR3",
36     [UNW_PPC32_R4]="GPR4",
37     [UNW_PPC32_R5]="GPR5",
38     [UNW_PPC32_R6]="GPR6",
39     [UNW_PPC32_R7]="GPR7",
40     [UNW_PPC32_R8]="GPR8",
41     [UNW_PPC32_R9]="GPR9",
42     [UNW_PPC32_R10]="GPR10",
43     [UNW_PPC32_R11]="GPR11",
44     [UNW_PPC32_R12]="GPR12",
45     [UNW_PPC32_R13]="GPR13",
46     [UNW_PPC32_R14]="GPR14",
47     [UNW_PPC32_R15]="GPR15",
48     [UNW_PPC32_R16]="GPR16",
49     [UNW_PPC32_R17]="GPR17",
50     [UNW_PPC32_R18]="GPR18",
51     [UNW_PPC32_R19]="GPR19",
52     [UNW_PPC32_R20]="GPR20",
53     [UNW_PPC32_R21]="GPR21",
54     [UNW_PPC32_R22]="GPR22",
55     [UNW_PPC32_R23]="GPR23",
56     [UNW_PPC32_R24]="GPR24",
57     [UNW_PPC32_R25]="GPR25",
58     [UNW_PPC32_R26]="GPR26",
59     [UNW_PPC32_R27]="GPR27",
60     [UNW_PPC32_R28]="GPR28",
61     [UNW_PPC32_R29]="GPR29",
62     [UNW_PPC32_R30]="GPR30",
63     [UNW_PPC32_R31]="GPR31",
64
65     [UNW_PPC32_CTR]="CTR",
66     [UNW_PPC32_XER]="XER",
67     [UNW_PPC32_CCR]="CCR",
68     [UNW_PPC32_LR]="LR",
69     [UNW_PPC32_FPSCR]="FPSCR",
70
71     [UNW_PPC32_F0]="FPR0",
72     [UNW_PPC32_F1]="FPR1",
73     [UNW_PPC32_F2]="FPR2",
74     [UNW_PPC32_F3]="FPR3",
75     [UNW_PPC32_F4]="FPR4",
76     [UNW_PPC32_F5]="FPR5",
77     [UNW_PPC32_F6]="FPR6",
78     [UNW_PPC32_F7]="FPR7",
79     [UNW_PPC32_F8]="FPR8",
80     [UNW_PPC32_F9]="FPR9",
81     [UNW_PPC32_F10]="FPR10",
82     [UNW_PPC32_F11]="FPR11",
83     [UNW_PPC32_F12]="FPR12",
84     [UNW_PPC32_F13]="FPR13",
85     [UNW_PPC32_F14]="FPR14",
86     [UNW_PPC32_F15]="FPR15",
87     [UNW_PPC32_F16]="FPR16",
88     [UNW_PPC32_F17]="FPR17",
89     [UNW_PPC32_F18]="FPR18",
90     [UNW_PPC32_F19]="FPR19",
91     [UNW_PPC32_F20]="FPR20",
92     [UNW_PPC32_F21]="FPR21",
93     [UNW_PPC32_F22]="FPR22",
94     [UNW_PPC32_F23]="FPR23",
95     [UNW_PPC32_F24]="FPR24",
96     [UNW_PPC32_F25]="FPR25",
97     [UNW_PPC32_F26]="FPR26",
98     [UNW_PPC32_F27]="FPR27",
99     [UNW_PPC32_F28]="FPR28",
100     [UNW_PPC32_F29]="FPR29",
101     [UNW_PPC32_F30]="FPR30",
102     [UNW_PPC32_F31]="FPR31"
103 };
104
105 PROTECTED const char *
106 unw_regname (unw_regnum_t reg)
107 {
108   if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
109     return regname[reg];
110   else
111     return "???";
112 }