]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/gdbserver/linux-ia64-low.c
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / gdbserver / linux-ia64-low.c
CommitLineData
0a30fbc4 1/* GNU/Linux/IA64 specific low level interface, for the remote server for GDB.
32d0add0 2 Copyright (C) 1995-2015 Free Software Foundation, Inc.
0a30fbc4
DJ
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
a9762ec7 8 the Free Software Foundation; either version 3 of the License, or
0a30fbc4
DJ
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
0a30fbc4
DJ
18
19#include "server.h"
58caa3dc 20#include "linux-low.h"
0a30fbc4
DJ
21
22#ifdef HAVE_SYS_REG_H
23#include <sys/reg.h>
24#endif
25
d05b4ac3
UW
26/* Defined in auto-generated file reg-ia64.c. */
27void init_registers_ia64 (void);
3aee8918 28extern const struct target_desc *tdesc_ia64;
d05b4ac3 29
7fb85e41 30#define ia64_num_regs 462
0a30fbc4
DJ
31
32#include <asm/ptrace_offsets.h>
33
2ec06d2e 34static int ia64_regmap[] =
0a30fbc4
DJ
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,
c14dfd32 259 PT_AR_EC,
0a30fbc4
DJ
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,
0a30fbc4
DJ
267 };
268
2ec06d2e
DJ
269static int
270ia64_cannot_store_register (int regno)
0a30fbc4
DJ
271{
272 return 0;
273}
274
2ec06d2e
DJ
275static int
276ia64_cannot_fetch_register (int regno)
0a30fbc4
DJ
277{
278 return 0;
279}
280
c14dfd32
PA
281/* GDB register numbers. */
282#define IA64_GR0_REGNUM 0
283#define IA64_FR0_REGNUM 128
284#define IA64_FR1_REGNUM 129
285
286static int
287ia64_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
3aee8918 294 gdb_assert (sizeof (zero) == register_size (regcache->tdesc, regnum));
c14dfd32
PA
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
3aee8918 304 gdb_assert (sizeof (f_zero) == register_size (regcache->tdesc, regnum));
c14dfd32
PA
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
3aee8918 315 gdb_assert (sizeof (f_one) == register_size (regcache->tdesc, regnum));
c14dfd32
PA
316 supply_register (regcache, regnum, f_one);
317 return 1;
318 }
319
320 return 0;
321}
322
3aee8918
PA
323static struct usrregs_info ia64_usrregs_info =
324 {
325 ia64_num_regs,
326 ia64_regmap,
327 };
328
329static struct regs_info regs_info =
330 {
331 NULL, /* regset_bitmap */
332 &ia64_usrregs_info
333 };
334
335static const struct regs_info *
336ia64_regs_info (void)
337{
338 return &regs_info;
339}
340
341static void
342ia64_arch_setup (void)
343{
344 current_process ()->tdesc = tdesc_ia64;
345}
346
347
2ec06d2e 348struct linux_target_ops the_low_target = {
3aee8918
PA
349 ia64_arch_setup,
350 ia64_regs_info,
2ec06d2e
DJ
351 ia64_cannot_fetch_register,
352 ia64_cannot_store_register,
c14dfd32 353 ia64_fetch_register,
2ec06d2e 354};
3aee8918
PA
355
356void
357initialize_low_arch (void)
358{
359 init_registers_ia64 ();
360}