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_PPC64_R0]="GPR0",
33 [UNW_PPC64_R1]="GPR1",
34 [UNW_PPC64_R2]="GPR2",
35 [UNW_PPC64_R3]="GPR3",
36 [UNW_PPC64_R4]="GPR4",
37 [UNW_PPC64_R5]="GPR5",
38 [UNW_PPC64_R6]="GPR6",
39 [UNW_PPC64_R7]="GPR7",
40 [UNW_PPC64_R8]="GPR8",
41 [UNW_PPC64_R9]="GPR9",
42 [UNW_PPC64_R10]="GPR10",
43 [UNW_PPC64_R11]="GPR11",
44 [UNW_PPC64_R12]="GPR12",
45 [UNW_PPC64_R13]="GPR13",
46 [UNW_PPC64_R14]="GPR14",
47 [UNW_PPC64_R15]="GPR15",
48 [UNW_PPC64_R16]="GPR16",
49 [UNW_PPC64_R17]="GPR17",
50 [UNW_PPC64_R18]="GPR18",
51 [UNW_PPC64_R19]="GPR19",
52 [UNW_PPC64_R20]="GPR20",
53 [UNW_PPC64_R21]="GPR21",
54 [UNW_PPC64_R22]="GPR22",
55 [UNW_PPC64_R23]="GPR23",
56 [UNW_PPC64_R24]="GPR24",
57 [UNW_PPC64_R25]="GPR25",
58 [UNW_PPC64_R26]="GPR26",
59 [UNW_PPC64_R27]="GPR27",
60 [UNW_PPC64_R28]="GPR28",
61 [UNW_PPC64_R29]="GPR29",
62 [UNW_PPC64_R30]="GPR30",
63 [UNW_PPC64_R31]="GPR31",
64
65 [UNW_PPC64_F0]="FPR0",
66 [UNW_PPC64_F1]="FPR1",
67 [UNW_PPC64_F2]="FPR2",
68 [UNW_PPC64_F3]="FPR3",
69 [UNW_PPC64_F4]="FPR4",
70 [UNW_PPC64_F5]="FPR5",
71 [UNW_PPC64_F6]="FPR6",
72 [UNW_PPC64_F7]="FPR7",
73 [UNW_PPC64_F8]="FPR8",
74 [UNW_PPC64_F9]="FPR9",
75 [UNW_PPC64_F10]="FPR10",
76 [UNW_PPC64_F11]="FPR11",
77 [UNW_PPC64_F12]="FPR12",
78 [UNW_PPC64_F13]="FPR13",
79 [UNW_PPC64_F14]="FPR14",
80 [UNW_PPC64_F15]="FPR15",
81 [UNW_PPC64_F16]="FPR16",
82 [UNW_PPC64_F17]="FPR17",
83 [UNW_PPC64_F18]="FPR18",
84 [UNW_PPC64_F19]="FPR19",
85 [UNW_PPC64_F20]="FPR20",
86 [UNW_PPC64_F21]="FPR21",
87 [UNW_PPC64_F22]="FPR22",
88 [UNW_PPC64_F23]="FPR23",
89 [UNW_PPC64_F24]="FPR24",
90 [UNW_PPC64_F25]="FPR25",
91 [UNW_PPC64_F26]="FPR26",
92 [UNW_PPC64_F27]="FPR27",
93 [UNW_PPC64_F28]="FPR28",
94 [UNW_PPC64_F29]="FPR29",
95 [UNW_PPC64_F30]="FPR30",
96 [UNW_PPC64_F31]="FPR31",
97
98 [UNW_PPC64_LR]="LR",
99 [UNW_PPC64_CTR]="CTR",
100 [UNW_PPC64_ARG_POINTER]="ARG_POINTER",
101
102 [UNW_PPC64_CR0]="CR0",
103 [UNW_PPC64_CR1]="CR1",
104 [UNW_PPC64_CR2]="CR2",
105 [UNW_PPC64_CR3]="CR3",
106 [UNW_PPC64_CR4]="CR4",
107 [UNW_PPC64_CR5]="CR5",
108 [UNW_PPC64_CR6]="CR6",
109 [UNW_PPC64_CR7]="CR7",
110
111 [UNW_PPC64_XER]="XER",
112
113 [UNW_PPC64_V0]="VR0",
114 [UNW_PPC64_V1]="VR1",
115 [UNW_PPC64_V2]="VR2",
116 [UNW_PPC64_V3]="VR3",
117 [UNW_PPC64_V4]="VR4",
118 [UNW_PPC64_V5]="VR5",
119 [UNW_PPC64_V6]="VR6",
120 [UNW_PPC64_V7]="VR7",
121 [UNW_PPC64_V8]="VR8",
122 [UNW_PPC64_V9]="VR9",
123 [UNW_PPC64_V10]="VR10",
124 [UNW_PPC64_V11]="VR11",
125 [UNW_PPC64_V12]="VR12",
126 [UNW_PPC64_V13]="VR13",
127 [UNW_PPC64_V14]="VR14",
128 [UNW_PPC64_V15]="VR15",
129 [UNW_PPC64_V16]="VR16",
130 [UNW_PPC64_V17]="VR17",
131 [UNW_PPC64_V18]="VR18",
132 [UNW_PPC64_V19]="VR19",
133 [UNW_PPC64_V20]="VR20",
134 [UNW_PPC64_V21]="VR21",
135 [UNW_PPC64_V22]="VR22",
136 [UNW_PPC64_V23]="VR23",
137 [UNW_PPC64_V24]="VR24",
138 [UNW_PPC64_V25]="VR25",
139 [UNW_PPC64_V26]="VR26",
140 [UNW_PPC64_V27]="VR27",
141 [UNW_PPC64_V28]="VR28",
142 [UNW_PPC64_V29]="VR29",
143 [UNW_PPC64_V30]="VR30",
144 [UNW_PPC64_V31]="VR31",
145
146 [UNW_PPC64_VSCR]="VSCR",
147
148 [UNW_PPC64_VRSAVE]="VRSAVE",
149 [UNW_PPC64_SPE_ACC]="SPE_ACC",
150 [UNW_PPC64_SPEFSCR]="SPEFSCR",
151
152 [UNW_PPC64_FRAME_POINTER]="FRAME_POINTER",
153 [UNW_PPC64_NIP]="NIP",
154
155 };
156
157 PROTECTED const char *
unw_regname(unw_regnum_t reg)158 unw_regname (unw_regnum_t reg)
159 {
160 if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
161 return regname[reg];
162 else
163 return "???";
164 }
165