1 // 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.
5 // OBSOLETE This file is part of GDB.
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.
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.
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. */
22 // OBSOLETE #include "defs.h"
23 // OBSOLETE #include "frame.h"
24 // OBSOLETE #include "inferior.h"
25 // OBSOLETE #include "regcache.h"
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>
34 // OBSOLETE #ifndef USER /* added to support BCS ptrace_user */
35 // OBSOLETE #define USER ptrace_user
37 // OBSOLETE #include <sys/ioctl.h>
38 // OBSOLETE #include <fcntl.h>
39 // OBSOLETE #include <sys/file.h>
40 // OBSOLETE #include "gdb_stat.h"
42 // OBSOLETE #include "symtab.h"
43 // OBSOLETE #include "setjmp.h"
44 // OBSOLETE #include "value.h"
46 // OBSOLETE #ifdef DELTA88
47 // OBSOLETE #include <sys/ptrace.h>
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)
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)
60 // OBSOLETE extern int have_symbol_file_p ();
62 // OBSOLETE extern jmp_buf stack_jmp;
64 // OBSOLETE extern int errno;
67 // OBSOLETE fetch_inferior_registers (int regno)
69 // OBSOLETE register unsigned int regaddr;
70 // OBSOLETE char buf[MAX_REGISTER_RAW_SIZE];
71 // OBSOLETE register int i;
73 // OBSOLETE struct USER u;
74 // OBSOLETE unsigned int offset;
76 // OBSOLETE offset = (char *) &u.pt_r0 - (char *) &u;
77 // OBSOLETE regaddr = offset; /* byte offset to r0; */
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++)
82 // OBSOLETE /*regaddr = register_addr (regno, offset); */
83 // OBSOLETE /* 88k enhancement */
85 // OBSOLETE for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
87 // OBSOLETE *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid),
88 // OBSOLETE (PTRACE_ARG3_TYPE) regaddr, 0);
89 // OBSOLETE regaddr += sizeof (int);
91 // OBSOLETE supply_register (regno, buf);
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);
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). */
110 // OBSOLETE store_inferior_registers (int regno)
112 // OBSOLETE register unsigned int regaddr;
113 // OBSOLETE char buf[80];
115 // OBSOLETE struct USER u;
117 // OBSOLETE unsigned int offset = (char *) &u.pt_r0 - (char *) &u;
119 // OBSOLETE regaddr = offset;
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)
126 // OBSOLETE /* regaddr = register_addr (regno, offset); */
127 // OBSOLETE if (regno < PC_REGNUM)
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)
135 // OBSOLETE sprintf (buf, "writing register number %d", regno);
136 // OBSOLETE perror_with_name (buf);
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));
149 // OBSOLETE printf_unfiltered ("Bad register number for store_inferior routine\n");
153 // OBSOLETE for (regno = 0; regno < PC_REGNUM; regno++)
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)
162 // OBSOLETE sprintf (buf, "writing register number %d", regno);
163 // OBSOLETE perror_with_name (buf);
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));
176 // OBSOLETE /* blockend is the address of the end of the user structure */
177 // OBSOLETE m88k_register_u_addr (int blockend, int regnum)
179 // OBSOLETE struct USER u;
180 // OBSOLETE int ustart = blockend - sizeof (struct USER);
181 // OBSOLETE switch (regnum)
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);
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));
234 // OBSOLETE return (blockend + REGISTER_SIZE * regnum);
238 // OBSOLETE #ifdef USE_PROC_FS
240 // OBSOLETE #include <sys/procfs.h>
242 // OBSOLETE /* Prototypes for supply_gregset etc. */
243 // OBSOLETE #include "gregset.h"
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. */
250 // OBSOLETE supply_gregset (gregset_t *gregsetp)
252 // OBSOLETE register int regi;
253 // OBSOLETE register greg_t *regp = (greg_t *) gregsetp;
255 // OBSOLETE for (regi = 0; regi <= SP_REGNUM; regi++)
256 // OBSOLETE supply_register (regi, (char *) (regp + regi));
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));
267 // OBSOLETE fill_gregset (gregset_t *gregsetp, int regno)
269 // OBSOLETE int regi;
270 // OBSOLETE register greg_t *regp = (greg_t *) gregsetp;
272 // OBSOLETE for (regi = 0; regi <= R_R31; regi++)
273 // OBSOLETE if ((regno == -1) || (regno == regi))
274 // OBSOLETE *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)];
276 // OBSOLETE if ((regno == -1) || (regno == SXIP_REGNUM))
277 // OBSOLETE *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)];
278 // OBSOLETE if ((regno == -1) || (regno == SNIP_REGNUM))
279 // OBSOLETE *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)];
280 // OBSOLETE if ((regno == -1) || (regno == SFIP_REGNUM))
281 // OBSOLETE *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)];
282 // OBSOLETE if ((regno == -1) || (regno == PSR_REGNUM))
283 // OBSOLETE *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)];
284 // OBSOLETE if ((regno == -1) || (regno == FPSR_REGNUM))
285 // OBSOLETE *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)];
286 // OBSOLETE if ((regno == -1) || (regno == FPCR_REGNUM))
287 // OBSOLETE *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)];
290 // OBSOLETE #endif /* USE_PROC_FS */
This page took 0.035507 seconds and 4 git commands to generate.