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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [m88k-nat.c] - Blame information for rev 1774

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

Line No. Rev Author Line
1 1181 sfurman
// OBSOLETE /* Native-dependent Motorola 88xxx support for GDB, the GNU Debugger.
2
// OBSOLETE    Copyright 1988, 1990, 1991, 1992, 1993, 1995, 1999, 2000, 2001
3
// OBSOLETE    Free Software Foundation, Inc.
4
// OBSOLETE 
5
// OBSOLETE    This file is part of GDB.
6
// OBSOLETE 
7
// OBSOLETE    This program is free software; you can redistribute it and/or modify
8
// OBSOLETE    it under the terms of the GNU General Public License as published by
9
// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
10
// OBSOLETE    (at your option) any later version.
11
// OBSOLETE 
12
// OBSOLETE    This program is distributed in the hope that it will be useful,
13
// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// OBSOLETE    GNU General Public License for more details.
16
// OBSOLETE 
17
// OBSOLETE    You should have received a copy of the GNU General Public License
18
// OBSOLETE    along with this program; if not, write to the Free Software
19
// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
20
// OBSOLETE    Boston, MA 02111-1307, USA.  */
21
// OBSOLETE 
22
// OBSOLETE #include "defs.h"
23
// OBSOLETE #include "frame.h"
24
// OBSOLETE #include "inferior.h"
25
// OBSOLETE #include "regcache.h"
26
// OBSOLETE 
27
// OBSOLETE #include <sys/types.h>
28
// OBSOLETE #include <sys/param.h>
29
// OBSOLETE #include <sys/dir.h>
30
// OBSOLETE #include <signal.h>
31
// OBSOLETE #include "gdbcore.h"
32
// OBSOLETE #include <sys/user.h>
33
// OBSOLETE 
34
// OBSOLETE #ifndef USER                        /* added to support BCS ptrace_user */
35
// OBSOLETE #define USER ptrace_user
36
// OBSOLETE #endif
37
// OBSOLETE #include <sys/ioctl.h>
38
// OBSOLETE #include <fcntl.h>
39
// OBSOLETE #include <sys/file.h>
40
// OBSOLETE #include "gdb_stat.h"
41
// OBSOLETE 
42
// OBSOLETE #include "symtab.h"
43
// OBSOLETE #include "setjmp.h"
44
// OBSOLETE #include "value.h"
45
// OBSOLETE 
46
// OBSOLETE #ifdef DELTA88
47
// OBSOLETE #include <sys/ptrace.h>
48
// OBSOLETE 
49
// OBSOLETE /* define offsets to the pc instruction offsets in ptrace_user struct */
50
// OBSOLETE #define SXIP_OFFSET ((char *)&u.pt_sigframe.sig_sxip - (char *)&u)
51
// OBSOLETE #define SNIP_OFFSET ((char *)&u.pt_sigframe.sig_snip - (char *)&u)
52
// OBSOLETE #define SFIP_OFFSET ((char *)&u.pt_sigframe.sig_sfip - (char *)&u)
53
// OBSOLETE #else
54
// OBSOLETE /* define offsets to the pc instruction offsets in ptrace_user struct */
55
// OBSOLETE #define SXIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sxip - (char *)&u)
56
// OBSOLETE #define SNIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_snip - (char *)&u)
57
// OBSOLETE #define SFIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sfip - (char *)&u)
58
// OBSOLETE #endif
59
// OBSOLETE 
60
// OBSOLETE extern int have_symbol_file_p ();
61
// OBSOLETE 
62
// OBSOLETE extern jmp_buf stack_jmp;
63
// OBSOLETE 
64
// OBSOLETE extern int errno;
65
// OBSOLETE 
66
// OBSOLETE void
67
// OBSOLETE fetch_inferior_registers (int regno)
68
// OBSOLETE {
69
// OBSOLETE   register unsigned int regaddr;
70
// OBSOLETE   char buf[MAX_REGISTER_RAW_SIZE];
71
// OBSOLETE   register int i;
72
// OBSOLETE 
73
// OBSOLETE   struct USER u;
74
// OBSOLETE   unsigned int offset;
75
// OBSOLETE 
76
// OBSOLETE   offset = (char *) &u.pt_r0 - (char *) &u;
77
// OBSOLETE   regaddr = offset;         /* byte offset to r0; */
78
// OBSOLETE 
79
// OBSOLETE /*  offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */
80
// OBSOLETE   for (regno = 0; regno < NUM_REGS; regno++)
81
// OBSOLETE     {
82
// OBSOLETE       /*regaddr = register_addr (regno, offset); */
83
// OBSOLETE       /* 88k enhancement  */
84
// OBSOLETE 
85
// OBSOLETE       for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
86
// OBSOLETE     {
87
// OBSOLETE       *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid),
88
// OBSOLETE                                  (PTRACE_ARG3_TYPE) regaddr, 0);
89
// OBSOLETE       regaddr += sizeof (int);
90
// OBSOLETE     }
91
// OBSOLETE       supply_register (regno, buf);
92
// OBSOLETE     }
93
// OBSOLETE   /* now load up registers 36 - 38; special pc registers */
94
// OBSOLETE   *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
95
// OBSOLETE                          (PTRACE_ARG3_TYPE) SXIP_OFFSET, 0);
96
// OBSOLETE   supply_register (SXIP_REGNUM, buf);
97
// OBSOLETE   *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
98
// OBSOLETE                          (PTRACE_ARG3_TYPE) SNIP_OFFSET, 0);
99
// OBSOLETE   supply_register (SNIP_REGNUM, buf);
100
// OBSOLETE   *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid),
101
// OBSOLETE                          (PTRACE_ARG3_TYPE) SFIP_OFFSET, 0);
102
// OBSOLETE   supply_register (SFIP_REGNUM, buf);
103
// OBSOLETE }
104
// OBSOLETE 
105
// OBSOLETE /* Store our register values back into the inferior.
106
// OBSOLETE    If REGNO is -1, do this for all registers.
107
// OBSOLETE    Otherwise, REGNO specifies which register (so we can save time).  */
108
// OBSOLETE 
109
// OBSOLETE void
110
// OBSOLETE store_inferior_registers (int regno)
111
// OBSOLETE {
112
// OBSOLETE   register unsigned int regaddr;
113
// OBSOLETE   char buf[80];
114
// OBSOLETE 
115
// OBSOLETE   struct USER u;
116
// OBSOLETE 
117
// OBSOLETE   unsigned int offset = (char *) &u.pt_r0 - (char *) &u;
118
// OBSOLETE 
119
// OBSOLETE   regaddr = offset;
120
// OBSOLETE 
121
// OBSOLETE   /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either
122
// OBSOLETE      svr3 doesn't run on an 88110, or the kernel isolates the different (not
123
// OBSOLETE      completely sure this is true, but seems to be.  */
124
// OBSOLETE   if (regno >= 0)
125
// OBSOLETE     {
126
// OBSOLETE       /*      regaddr = register_addr (regno, offset); */
127
// OBSOLETE       if (regno < PC_REGNUM)
128
// OBSOLETE     {
129
// OBSOLETE       regaddr = offset + regno * sizeof (int);
130
// OBSOLETE       errno = 0;
131
// OBSOLETE       ptrace (6, PIDGET (inferior_ptid),
132
// OBSOLETE               (PTRACE_ARG3_TYPE) regaddr, read_register (regno));
133
// OBSOLETE       if (errno != 0)
134
// OBSOLETE         {
135
// OBSOLETE           sprintf (buf, "writing register number %d", regno);
136
// OBSOLETE           perror_with_name (buf);
137
// OBSOLETE         }
138
// OBSOLETE     }
139
// OBSOLETE       else if (regno == SXIP_REGNUM)
140
// OBSOLETE     ptrace (6, PIDGET (inferior_ptid),
141
// OBSOLETE             (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno));
142
// OBSOLETE       else if (regno == SNIP_REGNUM)
143
// OBSOLETE     ptrace (6, PIDGET (inferior_ptid),
144
// OBSOLETE             (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno));
145
// OBSOLETE       else if (regno == SFIP_REGNUM)
146
// OBSOLETE     ptrace (6, PIDGET (inferior_ptid),
147
// OBSOLETE             (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno));
148
// OBSOLETE       else
149
// OBSOLETE     printf_unfiltered ("Bad register number for store_inferior routine\n");
150
// OBSOLETE     }
151
// OBSOLETE   else
152
// OBSOLETE     {
153
// OBSOLETE       for (regno = 0; regno < PC_REGNUM; regno++)
154
// OBSOLETE     {
155
// OBSOLETE       /*      regaddr = register_addr (regno, offset); */
156
// OBSOLETE       errno = 0;
157
// OBSOLETE       regaddr = offset + regno * sizeof (int);
158
// OBSOLETE       ptrace (6, PIDGET (inferior_ptid),
159
// OBSOLETE               (PTRACE_ARG3_TYPE) regaddr, read_register (regno));
160
// OBSOLETE       if (errno != 0)
161
// OBSOLETE         {
162
// OBSOLETE           sprintf (buf, "writing register number %d", regno);
163
// OBSOLETE           perror_with_name (buf);
164
// OBSOLETE         }
165
// OBSOLETE     }
166
// OBSOLETE       ptrace (6, PIDGET (inferior_ptid),
167
// OBSOLETE           (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM));
168
// OBSOLETE       ptrace (6, PIDGET (inferior_ptid),
169
// OBSOLETE           (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM));
170
// OBSOLETE       ptrace (6, PIDGET (inferior_ptid),
171
// OBSOLETE           (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM));
172
// OBSOLETE     }
173
// OBSOLETE }
174
// OBSOLETE 
175
// OBSOLETE 
176
// OBSOLETE /* blockend is the address of the end of the user structure */
177
// OBSOLETE m88k_register_u_addr (int blockend, int regnum)
178
// OBSOLETE {
179
// OBSOLETE   struct USER u;
180
// OBSOLETE   int ustart = blockend - sizeof (struct USER);
181
// OBSOLETE   switch (regnum)
182
// OBSOLETE     {
183
// OBSOLETE     case 0:
184
// OBSOLETE     case 1:
185
// OBSOLETE     case 2:
186
// OBSOLETE     case 3:
187
// OBSOLETE     case 4:
188
// OBSOLETE     case 5:
189
// OBSOLETE     case 6:
190
// OBSOLETE     case 7:
191
// OBSOLETE     case 8:
192
// OBSOLETE     case 9:
193
// OBSOLETE     case 10:
194
// OBSOLETE     case 11:
195
// OBSOLETE     case 12:
196
// OBSOLETE     case 13:
197
// OBSOLETE     case 14:
198
// OBSOLETE     case 15:
199
// OBSOLETE     case 16:
200
// OBSOLETE     case 17:
201
// OBSOLETE     case 18:
202
// OBSOLETE     case 19:
203
// OBSOLETE     case 20:
204
// OBSOLETE     case 21:
205
// OBSOLETE     case 22:
206
// OBSOLETE     case 23:
207
// OBSOLETE     case 24:
208
// OBSOLETE     case 25:
209
// OBSOLETE     case 26:
210
// OBSOLETE     case 27:
211
// OBSOLETE     case 28:
212
// OBSOLETE     case 29:
213
// OBSOLETE     case 30:
214
// OBSOLETE     case 31:
215
// OBSOLETE       return (ustart + ((int) &u.pt_r0 - (int) &u) + REGISTER_SIZE * regnum);
216
// OBSOLETE     case PSR_REGNUM:
217
// OBSOLETE       return (ustart + ((int) &u.pt_psr - (int) &u));
218
// OBSOLETE     case FPSR_REGNUM:
219
// OBSOLETE       return (ustart + ((int) &u.pt_fpsr - (int) &u));
220
// OBSOLETE     case FPCR_REGNUM:
221
// OBSOLETE       return (ustart + ((int) &u.pt_fpcr - (int) &u));
222
// OBSOLETE     case SXIP_REGNUM:
223
// OBSOLETE       return (ustart + SXIP_OFFSET);
224
// OBSOLETE     case SNIP_REGNUM:
225
// OBSOLETE       return (ustart + SNIP_OFFSET);
226
// OBSOLETE     case SFIP_REGNUM:
227
// OBSOLETE       return (ustart + SFIP_OFFSET);
228
// OBSOLETE     default:
229
// OBSOLETE       if (regnum < NUM_REGS)
230
// OBSOLETE     /* The register is one of those which is not defined...
231
// OBSOLETE        give it zero */
232
// OBSOLETE     return (ustart + ((int) &u.pt_r0 - (int) &u));
233
// OBSOLETE       else
234
// OBSOLETE     return (blockend + REGISTER_SIZE * regnum);
235
// OBSOLETE     }
236
// OBSOLETE }
237
// OBSOLETE 
238
// OBSOLETE #ifdef USE_PROC_FS
239
// OBSOLETE 
240
// OBSOLETE #include <sys/procfs.h>
241
// OBSOLETE 
242
// OBSOLETE /* Prototypes for supply_gregset etc. */
243
// OBSOLETE #include "gregset.h"
244
// OBSOLETE 
245
// OBSOLETE /*  Given a pointer to a general register set in /proc format (gregset_t *),
246
// OBSOLETE    unpack the register contents and supply them as gdb's idea of the current
247
// OBSOLETE    register values. */
248
// OBSOLETE 
249
// OBSOLETE void
250
// OBSOLETE supply_gregset (gregset_t *gregsetp)
251
// OBSOLETE {
252
// OBSOLETE   register int regi;
253
// OBSOLETE   register greg_t *regp = (greg_t *) gregsetp;
254
// OBSOLETE 
255
// OBSOLETE   for (regi = 0; regi <= SP_REGNUM; regi++)
256
// OBSOLETE     supply_register (regi, (char *) (regp + regi));
257
// OBSOLETE 
258
// OBSOLETE   supply_register (SXIP_REGNUM, (char *) (regp + R_XIP));
259
// OBSOLETE   supply_register (SNIP_REGNUM, (char *) (regp + R_NIP));
260
// OBSOLETE   supply_register (SFIP_REGNUM, (char *) (regp + R_FIP));
261
// OBSOLETE   supply_register (PSR_REGNUM, (char *) (regp + R_PSR));
262
// OBSOLETE   supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
263
// OBSOLETE   supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
264
// OBSOLETE }
265
// OBSOLETE 
266
// OBSOLETE void
267
// OBSOLETE fill_gregset (gregset_t *gregsetp, int regno)
268
// OBSOLETE {
269
// OBSOLETE   int regi;
270
// OBSOLETE   register greg_t *regp = (greg_t *) gregsetp;
271
// OBSOLETE 
272
// OBSOLETE   for (regi = 0; regi <= R_R31; regi++)
273
// OBSOLETE     if ((regno == -1) || (regno == regi))
274
// OBSOLETE       *(regp + regi) = *(int *) &registers[REGISTER_BYTE (regi)];
275
// OBSOLETE 
276
// OBSOLETE   if ((regno == -1) || (regno == SXIP_REGNUM))
277
// OBSOLETE     *(regp + R_XIP) = *(int *) &registers[REGISTER_BYTE (SXIP_REGNUM)];
278
// OBSOLETE   if ((regno == -1) || (regno == SNIP_REGNUM))
279
// OBSOLETE     *(regp + R_NIP) = *(int *) &registers[REGISTER_BYTE (SNIP_REGNUM)];
280
// OBSOLETE   if ((regno == -1) || (regno == SFIP_REGNUM))
281
// OBSOLETE     *(regp + R_FIP) = *(int *) &registers[REGISTER_BYTE (SFIP_REGNUM)];
282
// OBSOLETE   if ((regno == -1) || (regno == PSR_REGNUM))
283
// OBSOLETE     *(regp + R_PSR) = *(int *) &registers[REGISTER_BYTE (PSR_REGNUM)];
284
// OBSOLETE   if ((regno == -1) || (regno == FPSR_REGNUM))
285
// OBSOLETE     *(regp + R_FPSR) = *(int *) &registers[REGISTER_BYTE (FPSR_REGNUM)];
286
// OBSOLETE   if ((regno == -1) || (regno == FPCR_REGNUM))
287
// OBSOLETE     *(regp + R_FPCR) = *(int *) &registers[REGISTER_BYTE (FPCR_REGNUM)];
288
// OBSOLETE }
289
// OBSOLETE 
290
// OBSOLETE #endif /* USE_PROC_FS */

powered by: WebSVN 2.1.0

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