1 /* GNU/Linux/IA64 specific low level interface, for the remote server for GDB.
2    Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
3    Free Software 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 2 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, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21 
22 #include "server.h"
23 #include "linux-low.h"
24 
25 #ifdef HAVE_SYS_REG_H
26 #include <sys/reg.h>
27 #endif
28 
29 #define ia64_num_regs 590
30 
31 #include <asm/ptrace_offsets.h>
32 
33 static int ia64_regmap[] =
34   {
35     /* general registers */
36     -1,		/* gr0 not available; i.e, it's always zero */
37     PT_R1,
38     PT_R2,
39     PT_R3,
40     PT_R4,
41     PT_R5,
42     PT_R6,
43     PT_R7,
44     PT_R8,
45     PT_R9,
46     PT_R10,
47     PT_R11,
48     PT_R12,
49     PT_R13,
50     PT_R14,
51     PT_R15,
52     PT_R16,
53     PT_R17,
54     PT_R18,
55     PT_R19,
56     PT_R20,
57     PT_R21,
58     PT_R22,
59     PT_R23,
60     PT_R24,
61     PT_R25,
62     PT_R26,
63     PT_R27,
64     PT_R28,
65     PT_R29,
66     PT_R30,
67     PT_R31,
68     /* gr32 through gr127 not directly available via the ptrace interface */
69     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
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     /* Floating point registers */
76     -1, -1,	/* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */
77     PT_F2,
78     PT_F3,
79     PT_F4,
80     PT_F5,
81     PT_F6,
82     PT_F7,
83     PT_F8,
84     PT_F9,
85     PT_F10,
86     PT_F11,
87     PT_F12,
88     PT_F13,
89     PT_F14,
90     PT_F15,
91     PT_F16,
92     PT_F17,
93     PT_F18,
94     PT_F19,
95     PT_F20,
96     PT_F21,
97     PT_F22,
98     PT_F23,
99     PT_F24,
100     PT_F25,
101     PT_F26,
102     PT_F27,
103     PT_F28,
104     PT_F29,
105     PT_F30,
106     PT_F31,
107     PT_F32,
108     PT_F33,
109     PT_F34,
110     PT_F35,
111     PT_F36,
112     PT_F37,
113     PT_F38,
114     PT_F39,
115     PT_F40,
116     PT_F41,
117     PT_F42,
118     PT_F43,
119     PT_F44,
120     PT_F45,
121     PT_F46,
122     PT_F47,
123     PT_F48,
124     PT_F49,
125     PT_F50,
126     PT_F51,
127     PT_F52,
128     PT_F53,
129     PT_F54,
130     PT_F55,
131     PT_F56,
132     PT_F57,
133     PT_F58,
134     PT_F59,
135     PT_F60,
136     PT_F61,
137     PT_F62,
138     PT_F63,
139     PT_F64,
140     PT_F65,
141     PT_F66,
142     PT_F67,
143     PT_F68,
144     PT_F69,
145     PT_F70,
146     PT_F71,
147     PT_F72,
148     PT_F73,
149     PT_F74,
150     PT_F75,
151     PT_F76,
152     PT_F77,
153     PT_F78,
154     PT_F79,
155     PT_F80,
156     PT_F81,
157     PT_F82,
158     PT_F83,
159     PT_F84,
160     PT_F85,
161     PT_F86,
162     PT_F87,
163     PT_F88,
164     PT_F89,
165     PT_F90,
166     PT_F91,
167     PT_F92,
168     PT_F93,
169     PT_F94,
170     PT_F95,
171     PT_F96,
172     PT_F97,
173     PT_F98,
174     PT_F99,
175     PT_F100,
176     PT_F101,
177     PT_F102,
178     PT_F103,
179     PT_F104,
180     PT_F105,
181     PT_F106,
182     PT_F107,
183     PT_F108,
184     PT_F109,
185     PT_F110,
186     PT_F111,
187     PT_F112,
188     PT_F113,
189     PT_F114,
190     PT_F115,
191     PT_F116,
192     PT_F117,
193     PT_F118,
194     PT_F119,
195     PT_F120,
196     PT_F121,
197     PT_F122,
198     PT_F123,
199     PT_F124,
200     PT_F125,
201     PT_F126,
202     PT_F127,
203     /* predicate registers - we don't fetch these individually */
204     -1, -1, -1, -1, -1, -1, -1, -1,
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     /* branch registers */
213     PT_B0,
214     PT_B1,
215     PT_B2,
216     PT_B3,
217     PT_B4,
218     PT_B5,
219     PT_B6,
220     PT_B7,
221     /* virtual frame pointer and virtual return address pointer */
222     -1, -1,
223     /* other registers */
224     PT_PR,
225     PT_CR_IIP,	/* ip */
226     PT_CR_IPSR, /* psr */
227     PT_CFM,	/* cfm */
228     /* kernel registers not visible via ptrace interface (?) */
229     -1, -1, -1, -1, -1, -1, -1, -1,
230     /* hole */
231     -1, -1, -1, -1, -1, -1, -1, -1,
232     PT_AR_RSC,
233     PT_AR_BSP,
234     PT_AR_BSPSTORE,
235     PT_AR_RNAT,
236     -1,
237     -1,		/* Not available: FCR, IA32 floating control register */
238     -1, -1,
239     -1,		/* Not available: EFLAG */
240     -1,		/* Not available: CSD */
241     -1,		/* Not available: SSD */
242     -1,		/* Not available: CFLG */
243     -1,		/* Not available: FSR */
244     -1,		/* Not available: FIR */
245     -1,		/* Not available: FDR */
246     -1,
247     PT_AR_CCV,
248     -1, -1, -1,
249     PT_AR_UNAT,
250     -1, -1, -1,
251     PT_AR_FPSR,
252     -1, -1, -1,
253     -1,		/* Not available: ITC */
254     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
255     -1, -1, -1, -1, -1, -1, -1, -1, -1,
256     PT_AR_PFS,
257     PT_AR_LC,
258     -1,		/* Not available: EC, the Epilog Count register */
259     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
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,
266     /* nat bits - not fetched directly; instead we obtain these bits from
267        either rnat or unat or from memory. */
268     -1, -1, -1, -1, -1, -1, -1, -1,
269     -1, -1, -1, -1, -1, -1, -1, -1,
270     -1, -1, -1, -1, -1, -1, -1, -1,
271     -1, -1, -1, -1, -1, -1, -1, -1,
272     -1, -1, -1, -1, -1, -1, -1, -1,
273     -1, -1, -1, -1, -1, -1, -1, -1,
274     -1, -1, -1, -1, -1, -1, -1, -1,
275     -1, -1, -1, -1, -1, -1, -1, -1,
276     -1, -1, -1, -1, -1, -1, -1, -1,
277     -1, -1, -1, -1, -1, -1, -1, -1,
278     -1, -1, -1, -1, -1, -1, -1, -1,
279     -1, -1, -1, -1, -1, -1, -1, -1,
280     -1, -1, -1, -1, -1, -1, -1, -1,
281     -1, -1, -1, -1, -1, -1, -1, -1,
282     -1, -1, -1, -1, -1, -1, -1, -1,
283     -1, -1, -1, -1, -1, -1, -1, -1,
284   };
285 
286 static int
ia64_cannot_store_register(int regno)287 ia64_cannot_store_register (int regno)
288 {
289   return 0;
290 }
291 
292 static int
ia64_cannot_fetch_register(int regno)293 ia64_cannot_fetch_register (int regno)
294 {
295   return 0;
296 }
297 
298 struct linux_target_ops the_low_target = {
299   ia64_num_regs,
300   ia64_regmap,
301   ia64_cannot_fetch_register,
302   ia64_cannot_store_register,
303 };
304