OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [ultra3-nat.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* OBSOLETE /* Native-dependent code for GDB, for NYU Ultra3 running Sym1 OS. */
2
/* OBSOLETE    Copyright 1988, 1989, 1991, 1992, 1995, 1996, 1999, 2000, 2001 */
3
/* OBSOLETE    Free Software Foundation, Inc. */
4
/* OBSOLETE    Contributed by David Wood (wood@nyu.edu) at New York University. */
5
/* OBSOLETE  */
6
/* OBSOLETE    This file is part of GDB. */
7
/* OBSOLETE  */
8
/* OBSOLETE    This program is free software; you can redistribute it and/or modify */
9
/* OBSOLETE    it under the terms of the GNU General Public License as published by */
10
/* OBSOLETE    the Free Software Foundation; either version 2 of the License, or */
11
/* OBSOLETE    (at your option) any later version. */
12
/* OBSOLETE  */
13
/* OBSOLETE    This program is distributed in the hope that it will be useful, */
14
/* OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of */
15
/* OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
16
/* OBSOLETE    GNU General Public License for more details. */
17
/* OBSOLETE  */
18
/* OBSOLETE    You should have received a copy of the GNU General Public License */
19
/* OBSOLETE    along with this program; if not, write to the Free Software */
20
/* OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330, */
21
/* OBSOLETE    Boston, MA 02111-1307, USA.  */ */
22
/* OBSOLETE  */
23
/* OBSOLETE #define DEBUG */
24
/* OBSOLETE #include "defs.h" */
25
/* OBSOLETE #include "frame.h" */
26
/* OBSOLETE #include "inferior.h" */
27
/* OBSOLETE #include "symtab.h" */
28
/* OBSOLETE #include "value.h" */
29
/* OBSOLETE #include "regcache.h" */
30
/* OBSOLETE  */
31
/* OBSOLETE #include <sys/types.h> */
32
/* OBSOLETE #include <sys/param.h> */
33
/* OBSOLETE #include <signal.h> */
34
/* OBSOLETE #include <sys/ioctl.h> */
35
/* OBSOLETE #include <fcntl.h> */
36
/* OBSOLETE  */
37
/* OBSOLETE #include "gdbcore.h" */
38
/* OBSOLETE  */
39
/* OBSOLETE #include <sys/file.h> */
40
/* OBSOLETE #include "gdb_stat.h" */
41
/* OBSOLETE  */
42
/* OBSOLETE static void fetch_core_registers (char *, unsigned, int, CORE_ADDR); */
43
/* OBSOLETE  */
44
/* OBSOLETE /* Assumes support for AMD's Binary Compatibility Standard */
45
/* OBSOLETE    for ptrace().  If you define ULTRA3, the ultra3 extensions to */
46
/* OBSOLETE    ptrace() are used allowing the reading of more than one register */
47
/* OBSOLETE    at a time.  */
48
/* OBSOLETE  */
49
/* OBSOLETE    This file assumes KERNEL_DEBUGGING is turned off.  This means */
50
/* OBSOLETE    that if the user/gdb tries to read gr64-gr95 or any of the  */
51
/* OBSOLETE    protected special registers we silently return -1 (see the */
52
/* OBSOLETE    CANNOT_STORE/FETCH_REGISTER macros).  */ */
53
/* OBSOLETE #define     ULTRA3 */
54
/* OBSOLETE  */
55
/* OBSOLETE #if !defined (offsetof) */
56
/* OBSOLETE #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) */
57
/* OBSOLETE #endif */
58
/* OBSOLETE  */
59
/* OBSOLETE extern int errno; */
60
/* OBSOLETE struct ptrace_user pt_struct; */
61
/* OBSOLETE  */
62
/* OBSOLETE /* Get all available registers from the inferior.  Registers that are */
63
/* OBSOLETE  * defined in REGISTER_NAMES, but not available to the user/gdb are */
64
/* OBSOLETE  * supplied as -1.  This may include gr64-gr95 and the protected special */
65
/* OBSOLETE  * purpose registers. */
66
/* OBSOLETE  */ */
67
/* OBSOLETE  */
68
/* OBSOLETE void */
69
/* OBSOLETE fetch_inferior_registers (int regno) */
70
/* OBSOLETE { */
71
/* OBSOLETE   register int i, j, ret_val = 0; */
72
/* OBSOLETE   char buf[128]; */
73
/* OBSOLETE  */
74
/* OBSOLETE   if (regno != -1) */
75
/* OBSOLETE     { */
76
/* OBSOLETE       fetch_register (regno); */
77
/* OBSOLETE       return; */
78
/* OBSOLETE     } */
79
/* OBSOLETE  */
80
/* OBSOLETE /* Global Registers */ */
81
/* OBSOLETE #ifdef ULTRA3 */
82
/* OBSOLETE   errno = 0; */
83
/* OBSOLETE   ptrace (PT_READ_STRUCT, PIDGET (inferior_ptid), */
84
/* OBSOLETE       (PTRACE_ARG3_TYPE) register_addr (GR96_REGNUM, 0), */
85
/* OBSOLETE       (int) &pt_struct.pt_gr[0], 32 * 4); */
86
/* OBSOLETE   if (errno != 0) */
87
/* OBSOLETE     { */
88
/* OBSOLETE       perror_with_name ("reading global registers"); */
89
/* OBSOLETE       ret_val = -1; */
90
/* OBSOLETE     } */
91
/* OBSOLETE   else */
92
/* OBSOLETE     for (regno = GR96_REGNUM, j = 0; j < 32; regno++, j++) */
93
/* OBSOLETE       { */
94
/* OBSOLETE     supply_register (regno, &pt_struct.pt_gr[j]); */
95
/* OBSOLETE       } */
96
/* OBSOLETE #else */
97
/* OBSOLETE   for (regno = GR96_REGNUM; !ret_val && regno < GR96_REGNUM + 32; regno++) */
98
/* OBSOLETE     fetch_register (regno); */
99
/* OBSOLETE #endif */
100
/* OBSOLETE  */
101
/* OBSOLETE /* Local Registers */ */
102
/* OBSOLETE #ifdef ULTRA3 */
103
/* OBSOLETE   errno = 0; */
104
/* OBSOLETE   ptrace (PT_READ_STRUCT, PIDGET (inferior_ptid), */
105
/* OBSOLETE       (PTRACE_ARG3_TYPE) register_addr (LR0_REGNUM, 0), */
106
/* OBSOLETE       (int) &pt_struct.pt_lr[0], 128 * 4); */
107
/* OBSOLETE   if (errno != 0) */
108
/* OBSOLETE     { */
109
/* OBSOLETE       perror_with_name ("reading local registers"); */
110
/* OBSOLETE       ret_val = -1; */
111
/* OBSOLETE     } */
112
/* OBSOLETE   else */
113
/* OBSOLETE     for (regno = LR0_REGNUM, j = 0; j < 128; regno++, j++) */
114
/* OBSOLETE       { */
115
/* OBSOLETE     supply_register (regno, &pt_struct.pt_lr[j]); */
116
/* OBSOLETE       } */
117
/* OBSOLETE #else */
118
/* OBSOLETE   for (regno = LR0_REGNUM; !ret_val && regno < LR0_REGNUM + 128; regno++) */
119
/* OBSOLETE     fetch_register (regno); */
120
/* OBSOLETE #endif */
121
/* OBSOLETE  */
122
/* OBSOLETE /* Special Registers */ */
123
/* OBSOLETE   fetch_register (GR1_REGNUM); */
124
/* OBSOLETE   fetch_register (CPS_REGNUM); */
125
/* OBSOLETE   fetch_register (PC_REGNUM); */
126
/* OBSOLETE   fetch_register (NPC_REGNUM); */
127
/* OBSOLETE   fetch_register (PC2_REGNUM); */
128
/* OBSOLETE   fetch_register (IPC_REGNUM); */
129
/* OBSOLETE   fetch_register (IPA_REGNUM); */
130
/* OBSOLETE   fetch_register (IPB_REGNUM); */
131
/* OBSOLETE   fetch_register (Q_REGNUM); */
132
/* OBSOLETE   fetch_register (BP_REGNUM); */
133
/* OBSOLETE   fetch_register (FC_REGNUM); */
134
/* OBSOLETE  */
135
/* OBSOLETE /* Fake any registers that are in REGISTER_NAMES, but not available to gdb */ */
136
/* OBSOLETE   registers_fetched (); */
137
/* OBSOLETE } */
138
/* OBSOLETE  */
139
/* OBSOLETE /* Store our register values back into the inferior. */
140
/* OBSOLETE  * If REGNO is -1, do this for all registers. */
141
/* OBSOLETE  * Otherwise, REGNO specifies which register (so we can save time).   */
142
/* OBSOLETE  * NOTE: Assumes AMD's binary compatibility standard.  */
143
/* OBSOLETE  */ */
144
/* OBSOLETE  */
145
/* OBSOLETE void */
146
/* OBSOLETE store_inferior_registers (int regno) */
147
/* OBSOLETE { */
148
/* OBSOLETE   register unsigned int regaddr; */
149
/* OBSOLETE   char buf[80]; */
150
/* OBSOLETE  */
151
/* OBSOLETE   if (regno >= 0) */
152
/* OBSOLETE     { */
153
/* OBSOLETE       if (CANNOT_STORE_REGISTER (regno)) */
154
/* OBSOLETE     return; */
155
/* OBSOLETE       regaddr = register_addr (regno, 0); */
156
/* OBSOLETE       errno = 0; */
157
/* OBSOLETE       ptrace (PT_WRITE_U, PIDGET (inferior_ptid), */
158
/* OBSOLETE           (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); */
159
/* OBSOLETE       if (errno != 0) */
160
/* OBSOLETE     { */
161
/* OBSOLETE       sprintf (buf, "writing register %s (#%d)", REGISTER_NAME (regno), regno); */
162
/* OBSOLETE       perror_with_name (buf); */
163
/* OBSOLETE     } */
164
/* OBSOLETE     } */
165
/* OBSOLETE   else */
166
/* OBSOLETE     { */
167
/* OBSOLETE #ifdef ULTRA3 */
168
/* OBSOLETE       pt_struct.pt_gr1 = read_register (GR1_REGNUM); */
169
/* OBSOLETE       for (regno = GR96_REGNUM; regno < GR96_REGNUM + 32; regno++) */
170
/* OBSOLETE     pt_struct.pt_gr[regno] = read_register (regno); */
171
/* OBSOLETE       for (regno = LR0_REGNUM; regno < LR0_REGNUM + 128; regno++) */
172
/* OBSOLETE     pt_struct.pt_gr[regno] = read_register (regno); */
173
/* OBSOLETE       errno = 0; */
174
/* OBSOLETE       ptrace (PT_WRITE_STRUCT, PIDGET (inferior_ptid), */
175
/* OBSOLETE           (PTRACE_ARG3_TYPE) register_addr (GR1_REGNUM, 0), */
176
/* OBSOLETE           (int) &pt_struct.pt_gr1, (1 * 32 * 128) * 4); */
177
/* OBSOLETE       if (errno != 0) */
178
/* OBSOLETE     { */
179
/* OBSOLETE       sprintf (buf, "writing all local/global registers"); */
180
/* OBSOLETE       perror_with_name (buf); */
181
/* OBSOLETE     } */
182
/* OBSOLETE       pt_struct.pt_psr = read_register (CPS_REGNUM); */
183
/* OBSOLETE       pt_struct.pt_pc0 = read_register (NPC_REGNUM); */
184
/* OBSOLETE       pt_struct.pt_pc1 = read_register (PC_REGNUM); */
185
/* OBSOLETE       pt_struct.pt_pc2 = read_register (PC2_REGNUM); */
186
/* OBSOLETE       pt_struct.pt_ipc = read_register (IPC_REGNUM); */
187
/* OBSOLETE       pt_struct.pt_ipa = read_register (IPA_REGNUM); */
188
/* OBSOLETE       pt_struct.pt_ipb = read_register (IPB_REGNUM); */
189
/* OBSOLETE       pt_struct.pt_q = read_register (Q_REGNUM); */
190
/* OBSOLETE       pt_struct.pt_bp = read_register (BP_REGNUM); */
191
/* OBSOLETE       pt_struct.pt_fc = read_register (FC_REGNUM); */
192
/* OBSOLETE       errno = 0; */
193
/* OBSOLETE       ptrace (PT_WRITE_STRUCT, PIDGET (inferior_ptid), */
194
/* OBSOLETE           (PTRACE_ARG3_TYPE) register_addr (CPS_REGNUM, 0), */
195
/* OBSOLETE           (int) &pt_struct.pt_psr, (10) * 4); */
196
/* OBSOLETE       if (errno != 0) */
197
/* OBSOLETE     { */
198
/* OBSOLETE       sprintf (buf, "writing all special registers"); */
199
/* OBSOLETE       perror_with_name (buf); */
200
/* OBSOLETE       return; */
201
/* OBSOLETE     } */
202
/* OBSOLETE #else */
203
/* OBSOLETE       store_inferior_registers (GR1_REGNUM); */
204
/* OBSOLETE       for (regno = GR96_REGNUM; regno < GR96_REGNUM + 32; regno++) */
205
/* OBSOLETE     store_inferior_registers (regno); */
206
/* OBSOLETE       for (regno = LR0_REGNUM; regno < LR0_REGNUM + 128; regno++) */
207
/* OBSOLETE     store_inferior_registers (regno); */
208
/* OBSOLETE       store_inferior_registers (CPS_REGNUM); */
209
/* OBSOLETE       store_inferior_registers (PC_REGNUM); */
210
/* OBSOLETE       store_inferior_registers (NPC_REGNUM); */
211
/* OBSOLETE       store_inferior_registers (PC2_REGNUM); */
212
/* OBSOLETE       store_inferior_registers (IPC_REGNUM); */
213
/* OBSOLETE       store_inferior_registers (IPA_REGNUM); */
214
/* OBSOLETE       store_inferior_registers (IPB_REGNUM); */
215
/* OBSOLETE       store_inferior_registers (Q_REGNUM); */
216
/* OBSOLETE       store_inferior_registers (BP_REGNUM); */
217
/* OBSOLETE       store_inferior_registers (FC_REGNUM); */
218
/* OBSOLETE #endif /* ULTRA3 */ */
219
/* OBSOLETE     } */
220
/* OBSOLETE } */
221
/* OBSOLETE  */
222
/* OBSOLETE /*  */
223
/* OBSOLETE  * Fetch an individual register (and supply it). */
224
/* OBSOLETE  * return 0 on success, -1 on failure. */
225
/* OBSOLETE  * NOTE: Assumes AMD's Binary Compatibility Standard for ptrace(). */
226
/* OBSOLETE  */ */
227
/* OBSOLETE static void */
228
/* OBSOLETE fetch_register (int regno) */
229
/* OBSOLETE { */
230
/* OBSOLETE   char buf[128]; */
231
/* OBSOLETE   int val; */
232
/* OBSOLETE  */
233
/* OBSOLETE   if (CANNOT_FETCH_REGISTER (regno)) */
234
/* OBSOLETE     { */
235
/* OBSOLETE       val = -1; */
236
/* OBSOLETE       supply_register (regno, &val); */
237
/* OBSOLETE     } */
238
/* OBSOLETE   else */
239
/* OBSOLETE     { */
240
/* OBSOLETE       errno = 0; */
241
/* OBSOLETE       val = ptrace (PT_READ_U, PIDGET (inferior_ptid), */
242
/* OBSOLETE                 (PTRACE_ARG3_TYPE) register_addr (regno, 0), 0); */
243
/* OBSOLETE       if (errno != 0) */
244
/* OBSOLETE     { */
245
/* OBSOLETE       sprintf (buf, "reading register %s (#%d)", REGISTER_NAME (regno), regno); */
246
/* OBSOLETE       perror_with_name (buf); */
247
/* OBSOLETE     } */
248
/* OBSOLETE       else */
249
/* OBSOLETE     { */
250
/* OBSOLETE       supply_register (regno, &val); */
251
/* OBSOLETE     } */
252
/* OBSOLETE     } */
253
/* OBSOLETE } */
254
/* OBSOLETE  */
255
/* OBSOLETE  */
256
/* OBSOLETE /*  */
257
/* OBSOLETE  * Read AMD's Binary Compatibilty Standard conforming core file. */
258
/* OBSOLETE  * struct ptrace_user is the first thing in the core file */
259
/* OBSOLETE  * */
260
/* OBSOLETE  * CORE_REG_SECT, CORE_REG_SIZE, WHICH, and REG_ADDR are all ignored. */
261
/* OBSOLETE  */ */
262
/* OBSOLETE  */
263
/* OBSOLETE static void */
264
/* OBSOLETE fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, */
265
/* OBSOLETE                   int which, CORE_ADDR reg_addr) */
266
/* OBSOLETE { */
267
/* OBSOLETE   register int regno; */
268
/* OBSOLETE   int val; */
269
/* OBSOLETE   char buf[4]; */
270
/* OBSOLETE  */
271
/* OBSOLETE   for (regno = 0; regno < NUM_REGS; regno++) */
272
/* OBSOLETE     { */
273
/* OBSOLETE       if (!CANNOT_FETCH_REGISTER (regno)) */
274
/* OBSOLETE     { */
275
/* OBSOLETE       val = bfd_seek (core_bfd, (file_ptr) register_addr (regno, 0), SEEK_SET); */
276
/* OBSOLETE       if (val < 0 || (val = bfd_read (buf, sizeof buf, 1, core_bfd)) < 0) */
277
/* OBSOLETE         { */
278
/* OBSOLETE           char *buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) + 35); */
279
/* OBSOLETE           strcpy (buffer, "Reading core register "); */
280
/* OBSOLETE           strcat (buffer, REGISTER_NAME (regno)); */
281
/* OBSOLETE           perror_with_name (buffer); */
282
/* OBSOLETE         } */
283
/* OBSOLETE       supply_register (regno, buf); */
284
/* OBSOLETE     } */
285
/* OBSOLETE     } */
286
/* OBSOLETE  */
287
/* OBSOLETE   /* Fake any registers that are in REGISTER_NAMES, but not available to gdb */ */
288
/* OBSOLETE   registers_fetched (); */
289
/* OBSOLETE } */
290
/* OBSOLETE  */
291
/* OBSOLETE  */
292
/* OBSOLETE /*   */
293
/* OBSOLETE  * Takes a register number as defined in tm.h via REGISTER_NAMES, and maps */
294
/* OBSOLETE  * it to an offset in a struct ptrace_user defined by AMD's BCS. */
295
/* OBSOLETE  * That is, it defines the mapping between gdb register numbers and items in */
296
/* OBSOLETE  * a struct ptrace_user. */
297
/* OBSOLETE  * A register protection scheme is set up here.  If a register not */
298
/* OBSOLETE  * available to the user is specified in 'regno', then an address that */
299
/* OBSOLETE  * will cause ptrace() to fail is returned. */
300
/* OBSOLETE  */ */
301
/* OBSOLETE CORE_ADDR */
302
/* OBSOLETE register_addr (int regno, CORE_ADDR blockend) */
303
/* OBSOLETE { */
304
/* OBSOLETE   if ((regno >= LR0_REGNUM) && (regno < LR0_REGNUM + 128)) */
305
/* OBSOLETE     { */
306
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_lr[regno - LR0_REGNUM])); */
307
/* OBSOLETE     } */
308
/* OBSOLETE   else if ((regno >= GR96_REGNUM) && (regno < GR96_REGNUM + 32)) */
309
/* OBSOLETE     { */
310
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_gr[regno - GR96_REGNUM])); */
311
/* OBSOLETE     } */
312
/* OBSOLETE   else */
313
/* OBSOLETE     { */
314
/* OBSOLETE       switch (regno) */
315
/* OBSOLETE     { */
316
/* OBSOLETE     case GR1_REGNUM: */
317
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_gr1)); */
318
/* OBSOLETE     case CPS_REGNUM: */
319
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_psr)); */
320
/* OBSOLETE     case NPC_REGNUM: */
321
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_pc0)); */
322
/* OBSOLETE     case PC_REGNUM: */
323
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_pc1)); */
324
/* OBSOLETE     case PC2_REGNUM: */
325
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_pc2)); */
326
/* OBSOLETE     case IPC_REGNUM: */
327
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_ipc)); */
328
/* OBSOLETE     case IPA_REGNUM: */
329
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_ipa)); */
330
/* OBSOLETE     case IPB_REGNUM: */
331
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_ipb)); */
332
/* OBSOLETE     case Q_REGNUM: */
333
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_q)); */
334
/* OBSOLETE     case BP_REGNUM: */
335
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_bp)); */
336
/* OBSOLETE     case FC_REGNUM: */
337
/* OBSOLETE       return (offsetof (struct ptrace_user, pt_fc)); */
338
/* OBSOLETE     default: */
339
/* OBSOLETE       fprintf_filtered (gdb_stderr, "register_addr():Bad register %s (%d)\n", */
340
/* OBSOLETE                         REGISTER_NAME (regno), regno); */
341
/* OBSOLETE       return (0xffffffff);  /* Should make ptrace() fail */ */
342
/* OBSOLETE     } */
343
/* OBSOLETE     } */
344
/* OBSOLETE } */
345
/* OBSOLETE  */
346
/* OBSOLETE  */
347
/* OBSOLETE /* Register that we are able to handle ultra3 core file formats. */
348
/* OBSOLETE    FIXME: is this really bfd_target_unknown_flavour? */ */
349
/* OBSOLETE  */
350
/* OBSOLETE static struct core_fns ultra3_core_fns = */
351
/* OBSOLETE { */
352
/* OBSOLETE   bfd_target_unknown_flavour,               /* core_flavour */ */
353
/* OBSOLETE   default_check_format,                     /* check_format */ */
354
/* OBSOLETE   default_core_sniffer,                     /* core_sniffer */ */
355
/* OBSOLETE   fetch_core_registers,                     /* core_read_registers */ */
356
/* OBSOLETE   NULL                                      /* next */ */
357
/* OBSOLETE }; */
358
/* OBSOLETE  */
359
/* OBSOLETE void */
360
/* OBSOLETE _initialize_core_ultra3 (void) */
361
/* OBSOLETE { */
362
/* OBSOLETE   add_core_fns (&ultra3_core_fns); */
363
/* OBSOLETE } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.