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