Line data Source code
1 : /* Register names and numbers for IA64 DWARF.
2 : Copyright (C) 2006 Red Hat, Inc.
3 : This file is part of elfutils.
4 :
5 : This file is free software; you can redistribute it and/or modify
6 : it under the terms of either
7 :
8 : * the GNU Lesser General Public License as published by the Free
9 : Software Foundation; either version 3 of the License, or (at
10 : your option) any later version
11 :
12 : or
13 :
14 : * the GNU General Public License as published by the Free
15 : Software Foundation; either version 2 of the License, or (at
16 : your option) any later version
17 :
18 : or both in parallel, as here.
19 :
20 : elfutils is distributed in the hope that it will be useful, but
21 : WITHOUT ANY WARRANTY; without even the implied warranty of
22 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 : General Public License for more details.
24 :
25 : You should have received copies of the GNU General Public License and
26 : the GNU Lesser General Public License along with this program. If
27 : not, see <http://www.gnu.org/licenses/>. */
28 :
29 : #ifdef HAVE_CONFIG_H
30 : # include <config.h>
31 : #endif
32 :
33 : #include <string.h>
34 : #include <dwarf.h>
35 :
36 : #define BACKEND i386_
37 : #include "libebl_CPU.h"
38 :
39 : ssize_t
40 0 : ia64_register_info (Ebl *ebl __attribute__ ((unused)),
41 : int regno, char *name, size_t namelen,
42 : const char **prefix, const char **setname,
43 : int *bits, int *type)
44 : {
45 0 : if (name == NULL)
46 : return 687 + 64;
47 :
48 0 : if (regno < 0 || regno > 687 + 63 || namelen < 12)
49 : return -1;
50 :
51 0 : *prefix = "ar.";
52 0 : *setname = "application";
53 0 : *bits = 64;
54 0 : *type = DW_ATE_signed;
55 0 : switch (regno)
56 : {
57 0 : case 0 ... 9:
58 0 : name[0] = 'r';
59 0 : name[1] = (regno - 0) + '0';
60 0 : namelen = 2;
61 0 : *setname = "integer";
62 0 : *prefix = "";
63 0 : break;
64 :
65 0 : case 10 ... 99:
66 0 : name[0] = 'r';
67 0 : name[1] = (regno - 0) / 10 + '0';
68 0 : name[2] = (regno - 0) % 10 + '0';
69 0 : namelen = 3;
70 0 : *setname = "integer";
71 0 : *prefix = "";
72 0 : break;
73 :
74 0 : case 100 ... 127:
75 0 : name[0] = 'r';
76 0 : name[1] = '1';
77 0 : name[2] = (regno - 100) / 10 + '0';
78 0 : name[3] = (regno - 0) % 10 + '0';
79 0 : namelen = 4;
80 0 : *setname = "integer";
81 0 : *prefix = "";
82 0 : break;
83 :
84 0 : case 128 + 0 ... 128 + 9:
85 0 : name[0] = 'f';
86 0 : name[1] = (regno - 128) + '0';
87 0 : namelen = 2;
88 0 : *type = DW_ATE_float;
89 0 : *bits = 128;
90 0 : *setname = "FPU";
91 0 : *prefix = "";
92 0 : break;
93 :
94 0 : case 128 + 10 ... 128 + 99:
95 0 : name[0] = 'f';
96 0 : name[1] = (regno - 128) / 10 + '0';
97 0 : name[2] = (regno - 128) % 10 + '0';
98 0 : namelen = 3;
99 0 : *setname = "FPU";
100 0 : *prefix = "";
101 0 : break;
102 :
103 0 : case 128 + 100 ... 128 + 127:
104 0 : name[0] = 'f';
105 0 : name[1] = '1';
106 0 : name[2] = (regno - 128 - 100) / 10 + '0';
107 0 : name[3] = (regno - 128) % 10 + '0';
108 0 : namelen = 4;
109 0 : *type = DW_ATE_float;
110 0 : *bits = 128;
111 0 : *setname = "FPU";
112 0 : *prefix = "";
113 0 : break;
114 :
115 0 : case 320 + 0 ... 320 + 7:
116 0 : name[0] = 'b';
117 0 : name[1] = (regno - 320) + '0';
118 0 : namelen = 2;
119 0 : *type = DW_ATE_address;
120 0 : *setname = "branch";
121 0 : *prefix = "";
122 0 : break;
123 :
124 0 : case 328 ... 333:
125 : {
126 0 : static const char named_special[][5] =
127 : {
128 : "vfp", "vrap", "pr", "ip", "psr", "cfm"
129 : };
130 0 : *setname = "special";
131 0 : *prefix = "";
132 0 : *type = regno == 331 ? DW_ATE_address : DW_ATE_unsigned;
133 0 : return stpcpy (name, named_special[regno - 328]) + 1 - name;
134 : }
135 :
136 0 : case 590:
137 0 : *setname = "special";
138 0 : *prefix = "";
139 0 : *type = DW_ATE_unsigned;
140 0 : return stpcpy (name, "bof") + 1 - name;
141 :
142 0 : case 334 + 0 ... 334 + 7:
143 0 : name[0] = 'k';
144 0 : name[1] = 'r';
145 0 : name[2] = (regno - 334) + '0';
146 0 : namelen = 3;
147 0 : *prefix = "";
148 0 : break;
149 :
150 0 : case 334 + 8 ... 334 + 127:
151 : {
152 0 : static const char named_ar[][9] =
153 : {
154 : [16 - 8] = "rsc",
155 : [17 - 8] = "bsp",
156 : [18 - 8] = "bspstore",
157 : [19 - 8] = "rnat",
158 : [21 - 8] = "fcr",
159 : [24 - 8] = "eflag",
160 : [25 - 8] = "csd",
161 : [26 - 8] = "ssd",
162 : [27 - 8] = "cflg",
163 : [28 - 8] = "fsr",
164 : [29 - 8] = "fir",
165 : [30 - 8] = "fdr",
166 : [32 - 8] = "ccv",
167 : [36 - 8] = "unat",
168 : [40 - 8] = "fpsr",
169 : [44 - 8] = "itc",
170 : [64 - 8] = "pfs",
171 : [65 - 8] = "lc",
172 : [66 - 8] = "ec",
173 : };
174 0 : const size_t idx = regno - (334 + 8);
175 0 : *type = DW_ATE_unsigned;
176 0 : if (idx == 1 || idx == 2)
177 0 : *type = DW_ATE_address;
178 0 : if (idx < sizeof named_ar / sizeof named_ar[0]
179 0 : && named_ar[idx][0] != '\0')
180 0 : return stpcpy (name, named_ar[idx]) + 1 - name;
181 :
182 0 : name[0] = 'a';
183 0 : name[1] = 'r';
184 0 : switch (regno - 334)
185 : {
186 0 : case 0 ... 9:
187 0 : name[2] = (regno - 334) + '0';
188 0 : namelen = 3;
189 0 : break;
190 0 : case 10 ... 99:
191 0 : name[2] = (regno - 334) / 10 + '0';
192 0 : name[3] = (regno - 334) % 10 + '0';
193 0 : namelen = 4;
194 0 : break;
195 0 : case 100 ... 127:
196 0 : name[2] = '1';
197 0 : name[3] = (regno - 334 - 100) / 10 + '0';
198 0 : name[4] = (regno - 334) % 10 + '0';
199 0 : namelen = 5;
200 0 : break;
201 : }
202 0 : *prefix = "";
203 0 : break;
204 : }
205 :
206 0 : case 462 + 0 ... 462 + 9:
207 0 : name[0] = 'n';
208 0 : name[1] = 'a';
209 0 : name[2] = 't';
210 0 : name[3] = (regno - 462) + '0';
211 0 : namelen = 4;
212 0 : *setname = "NAT";
213 0 : *type = DW_ATE_boolean;
214 0 : *bits = 1;
215 0 : *prefix = "";
216 0 : break;
217 :
218 0 : case 462 + 10 ... 462 + 99:
219 0 : name[0] = 'n';
220 0 : name[1] = 'a';
221 0 : name[2] = 't';
222 0 : name[3] = (regno - 462) / 10 + '0';
223 0 : name[4] = (regno - 462) % 10 + '0';
224 0 : namelen = 5;
225 0 : *setname = "NAT";
226 0 : *type = DW_ATE_boolean;
227 0 : *bits = 1;
228 0 : *prefix = "";
229 0 : break;
230 :
231 0 : case 462 + 100 ... 462 + 127:
232 0 : name[0] = 'n';
233 0 : name[1] = 'a';
234 0 : name[2] = 't';
235 0 : name[3] = '1';
236 0 : name[4] = (regno - 462 - 100) / 10 + '0';
237 0 : name[5] = (regno - 462) % 10 + '0';
238 0 : namelen = 6;
239 0 : *setname = "NAT";
240 0 : *type = DW_ATE_boolean;
241 0 : *bits = 1;
242 0 : *prefix = "";
243 0 : break;
244 :
245 0 : case 687 + 0 ... 687 + 9:
246 0 : name[0] = 'p';
247 0 : name[1] = (regno - 687) + '0';
248 0 : namelen = 2;
249 0 : *setname = "predicate";
250 0 : *type = DW_ATE_boolean;
251 0 : *bits = 1;
252 0 : *prefix = "";
253 0 : break;
254 :
255 0 : case 687 + 10 ... 687 + 63:
256 0 : name[0] = 'p';
257 0 : name[1] = (regno - 687) / 10 + '0';
258 0 : name[2] = (regno - 687) % 10 + '0';
259 0 : namelen = 3;
260 0 : *setname = "predicate";
261 0 : *type = DW_ATE_boolean;
262 0 : *bits = 1;
263 0 : *prefix = "";
264 0 : break;
265 :
266 0 : default:
267 0 : *setname = NULL;
268 0 : return 0;
269 : }
270 :
271 0 : name[namelen++] = '\0';
272 0 : return namelen;
273 : }
|