gdb/
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-ia64-low.c
1 /* GNU/Linux/IA64 specific low level interface, for the remote server for GDB.
2 Copyright (C) 1995-1996, 1998-2002, 2007-2012 Free Software
3 Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #include "server.h"
21 #include "linux-low.h"
22
23 #ifdef HAVE_SYS_REG_H
24 #include <sys/reg.h>
25 #endif
26
27 /* Defined in auto-generated file reg-ia64.c. */
28 void init_registers_ia64 (void);
29
30 #define ia64_num_regs 462
31
32 #include <asm/ptrace_offsets.h>
33
34 static int ia64_regmap[] =
35 {
36 /* general registers */
37 -1, /* gr0 not available; i.e, it's always zero */
38 PT_R1,
39 PT_R2,
40 PT_R3,
41 PT_R4,
42 PT_R5,
43 PT_R6,
44 PT_R7,
45 PT_R8,
46 PT_R9,
47 PT_R10,
48 PT_R11,
49 PT_R12,
50 PT_R13,
51 PT_R14,
52 PT_R15,
53 PT_R16,
54 PT_R17,
55 PT_R18,
56 PT_R19,
57 PT_R20,
58 PT_R21,
59 PT_R22,
60 PT_R23,
61 PT_R24,
62 PT_R25,
63 PT_R26,
64 PT_R27,
65 PT_R28,
66 PT_R29,
67 PT_R30,
68 PT_R31,
69 /* gr32 through gr127 not directly available via the ptrace interface */
70 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
71 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
72 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
73 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
74 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
75 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
76 /* Floating point registers */
77 -1, -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */
78 PT_F2,
79 PT_F3,
80 PT_F4,
81 PT_F5,
82 PT_F6,
83 PT_F7,
84 PT_F8,
85 PT_F9,
86 PT_F10,
87 PT_F11,
88 PT_F12,
89 PT_F13,
90 PT_F14,
91 PT_F15,
92 PT_F16,
93 PT_F17,
94 PT_F18,
95 PT_F19,
96 PT_F20,
97 PT_F21,
98 PT_F22,
99 PT_F23,
100 PT_F24,
101 PT_F25,
102 PT_F26,
103 PT_F27,
104 PT_F28,
105 PT_F29,
106 PT_F30,
107 PT_F31,
108 PT_F32,
109 PT_F33,
110 PT_F34,
111 PT_F35,
112 PT_F36,
113 PT_F37,
114 PT_F38,
115 PT_F39,
116 PT_F40,
117 PT_F41,
118 PT_F42,
119 PT_F43,
120 PT_F44,
121 PT_F45,
122 PT_F46,
123 PT_F47,
124 PT_F48,
125 PT_F49,
126 PT_F50,
127 PT_F51,
128 PT_F52,
129 PT_F53,
130 PT_F54,
131 PT_F55,
132 PT_F56,
133 PT_F57,
134 PT_F58,
135 PT_F59,
136 PT_F60,
137 PT_F61,
138 PT_F62,
139 PT_F63,
140 PT_F64,
141 PT_F65,
142 PT_F66,
143 PT_F67,
144 PT_F68,
145 PT_F69,
146 PT_F70,
147 PT_F71,
148 PT_F72,
149 PT_F73,
150 PT_F74,
151 PT_F75,
152 PT_F76,
153 PT_F77,
154 PT_F78,
155 PT_F79,
156 PT_F80,
157 PT_F81,
158 PT_F82,
159 PT_F83,
160 PT_F84,
161 PT_F85,
162 PT_F86,
163 PT_F87,
164 PT_F88,
165 PT_F89,
166 PT_F90,
167 PT_F91,
168 PT_F92,
169 PT_F93,
170 PT_F94,
171 PT_F95,
172 PT_F96,
173 PT_F97,
174 PT_F98,
175 PT_F99,
176 PT_F100,
177 PT_F101,
178 PT_F102,
179 PT_F103,
180 PT_F104,
181 PT_F105,
182 PT_F106,
183 PT_F107,
184 PT_F108,
185 PT_F109,
186 PT_F110,
187 PT_F111,
188 PT_F112,
189 PT_F113,
190 PT_F114,
191 PT_F115,
192 PT_F116,
193 PT_F117,
194 PT_F118,
195 PT_F119,
196 PT_F120,
197 PT_F121,
198 PT_F122,
199 PT_F123,
200 PT_F124,
201 PT_F125,
202 PT_F126,
203 PT_F127,
204 /* predicate registers - we don't fetch these individually */
205 -1, -1, -1, -1, -1, -1, -1, -1,
206 -1, -1, -1, -1, -1, -1, -1, -1,
207 -1, -1, -1, -1, -1, -1, -1, -1,
208 -1, -1, -1, -1, -1, -1, -1, -1,
209 -1, -1, -1, -1, -1, -1, -1, -1,
210 -1, -1, -1, -1, -1, -1, -1, -1,
211 -1, -1, -1, -1, -1, -1, -1, -1,
212 -1, -1, -1, -1, -1, -1, -1, -1,
213 /* branch registers */
214 PT_B0,
215 PT_B1,
216 PT_B2,
217 PT_B3,
218 PT_B4,
219 PT_B5,
220 PT_B6,
221 PT_B7,
222 /* virtual frame pointer and virtual return address pointer */
223 -1, -1,
224 /* other registers */
225 PT_PR,
226 PT_CR_IIP, /* ip */
227 PT_CR_IPSR, /* psr */
228 PT_CFM, /* cfm */
229 /* kernel registers not visible via ptrace interface (?) */
230 -1, -1, -1, -1, -1, -1, -1, -1,
231 /* hole */
232 -1, -1, -1, -1, -1, -1, -1, -1,
233 PT_AR_RSC,
234 PT_AR_BSP,
235 PT_AR_BSPSTORE,
236 PT_AR_RNAT,
237 -1,
238 -1, /* Not available: FCR, IA32 floating control register */
239 -1, -1,
240 -1, /* Not available: EFLAG */
241 -1, /* Not available: CSD */
242 -1, /* Not available: SSD */
243 -1, /* Not available: CFLG */
244 -1, /* Not available: FSR */
245 -1, /* Not available: FIR */
246 -1, /* Not available: FDR */
247 -1,
248 PT_AR_CCV,
249 -1, -1, -1,
250 PT_AR_UNAT,
251 -1, -1, -1,
252 PT_AR_FPSR,
253 -1, -1, -1,
254 -1, /* Not available: ITC */
255 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
256 -1, -1, -1, -1, -1, -1, -1, -1, -1,
257 PT_AR_PFS,
258 PT_AR_LC,
259 PT_AR_EC,
260 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
261 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
262 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
263 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
264 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
265 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
266 -1,
267 };
268
269 static int
270 ia64_cannot_store_register (int regno)
271 {
272 return 0;
273 }
274
275 static int
276 ia64_cannot_fetch_register (int regno)
277 {
278 return 0;
279 }
280
281 /* GDB register numbers. */
282 #define IA64_GR0_REGNUM 0
283 #define IA64_FR0_REGNUM 128
284 #define IA64_FR1_REGNUM 129
285
286 static int
287 ia64_fetch_register (struct regcache *regcache, int regnum)
288 {
289 /* r0 cannot be fetched but is always zero. */
290 if (regnum == IA64_GR0_REGNUM)
291 {
292 const gdb_byte zero[8] = { 0 };
293
294 gdb_assert (sizeof (zero) == register_size (regnum));
295 supply_register (regcache, regnum, zero);
296 return 1;
297 }
298
299 /* fr0 cannot be fetched but is always zero. */
300 if (regnum == IA64_FR0_REGNUM)
301 {
302 const gdb_byte f_zero[16] = { 0 };
303
304 gdb_assert (sizeof (f_zero) == register_size (regnum));
305 supply_register (regcache, regnum, f_zero);
306 return 1;
307 }
308
309 /* fr1 cannot be fetched but is always one (1.0). */
310 if (regnum == IA64_FR1_REGNUM)
311 {
312 const gdb_byte f_one[16] =
313 { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
314
315 gdb_assert (sizeof (f_one) == register_size (regnum));
316 supply_register (regcache, regnum, f_one);
317 return 1;
318 }
319
320 return 0;
321 }
322
323 struct linux_target_ops the_low_target = {
324 init_registers_ia64,
325 ia64_num_regs,
326 ia64_regmap,
327 NULL,
328 ia64_cannot_fetch_register,
329 ia64_cannot_store_register,
330 ia64_fetch_register,
331 };
This page took 0.047211 seconds and 4 git commands to generate.