]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Native support for Motorola 88k running Harris CX/UX. |
b6ba6518 KB |
2 | Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, |
3 | 2001 Free Software Foundation, Inc. | |
c906108c | 4 | |
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
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. | |
c906108c | 11 | |
c5aa993b JM |
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. | |
c906108c | 16 | |
c5aa993b JM |
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. */ | |
c906108c SS |
21 | |
22 | #include "defs.h" | |
23 | #include "frame.h" | |
24 | #include "inferior.h" | |
25 | ||
26 | #include <sys/types.h> | |
27 | #include <sys/param.h> | |
28 | #include <sys/dir.h> | |
29 | #include <signal.h> | |
30 | #include "gdbcore.h" | |
31 | #include <sys/user.h> | |
32 | ||
33 | #include "bfd.h" | |
34 | #include "symfile.h" | |
35 | #include "objfiles.h" | |
36 | #include "symtab.h" | |
4e052eda | 37 | #include "regcache.h" |
c906108c SS |
38 | |
39 | #ifndef USER /* added to support BCS ptrace_user */ | |
40 | #define USER ptrace_user | |
41 | #endif | |
42 | #include <sys/ioctl.h> | |
43 | #include <fcntl.h> | |
44 | #include <sys/file.h> | |
45 | #include "gdb_stat.h" | |
46 | ||
47 | #include "symtab.h" | |
48 | #include "setjmp.h" | |
49 | #include "value.h" | |
50 | ||
51 | #include <sys/ptrace.h> | |
52 | ||
53 | /* CX/UX provides them already, but as word offsets instead of char offsets */ | |
54 | #define SXIP_OFFSET (PT_SXIP * 4) | |
55 | #define SNIP_OFFSET (PT_SNIP * 4) | |
56 | #define SFIP_OFFSET (PT_SFIP * 4) | |
57 | #define PSR_OFFSET (PT_PSR * sizeof(int)) | |
58 | #define FPSR_OFFSET (PT_FPSR * sizeof(int)) | |
59 | #define FPCR_OFFSET (PT_FPCR * sizeof(int)) | |
60 | ||
61 | #define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \ | |
62 | ((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE)) | |
63 | ||
c5aa993b | 64 | extern int have_symbol_file_p (); |
c906108c SS |
65 | |
66 | extern jmp_buf stack_jmp; | |
67 | ||
68 | extern int errno; | |
c906108c SS |
69 | |
70 | void | |
72623009 | 71 | fetch_inferior_registers (int regno) |
c906108c SS |
72 | { |
73 | register unsigned int regaddr; | |
74 | char buf[MAX_REGISTER_RAW_SIZE]; | |
75 | register int i; | |
76 | ||
77 | struct USER u; | |
78 | unsigned int offset; | |
79 | ||
c5aa993b JM |
80 | offset = (char *) &u.pt_r0 - (char *) &u; |
81 | regaddr = offset; /* byte offset to r0; */ | |
c906108c | 82 | |
39f77062 | 83 | /* offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ |
c906108c SS |
84 | for (regno = 0; regno < PC_REGNUM; regno++) |
85 | { | |
c5aa993b JM |
86 | /*regaddr = register_addr (regno, offset); */ |
87 | /* 88k enhancement */ | |
88 | ||
c906108c | 89 | for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) |
c5aa993b | 90 | { |
39f77062 | 91 | *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid), |
c906108c | 92 | (PTRACE_ARG3_TYPE) regaddr, 0); |
c5aa993b JM |
93 | regaddr += sizeof (int); |
94 | } | |
c906108c SS |
95 | supply_register (regno, buf); |
96 | } | |
c5aa993b | 97 | /* now load up registers 32-37; special pc registers */ |
39f77062 | 98 | *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
99 | (PTRACE_ARG3_TYPE) PSR_OFFSET, 0); |
100 | supply_register (PSR_REGNUM, buf); | |
39f77062 | 101 | *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
102 | (PTRACE_ARG3_TYPE) FPSR_OFFSET, 0); |
103 | supply_register (FPSR_REGNUM, buf); | |
39f77062 | 104 | *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
105 | (PTRACE_ARG3_TYPE) FPCR_OFFSET, 0); |
106 | supply_register (FPCR_REGNUM, buf); | |
39f77062 | 107 | *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
108 | (PTRACE_ARG3_TYPE) SXIP_OFFSET, 0); |
109 | supply_register (SXIP_REGNUM, buf); | |
39f77062 | 110 | *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
111 | (PTRACE_ARG3_TYPE) SNIP_OFFSET, 0); |
112 | supply_register (SNIP_REGNUM, buf); | |
39f77062 | 113 | *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
114 | (PTRACE_ARG3_TYPE) SFIP_OFFSET, 0); |
115 | supply_register (SFIP_REGNUM, buf); | |
116 | ||
117 | if (target_is_m88110) | |
118 | { | |
119 | for (regaddr = XREGADDR (X0_REGNUM), regno = X0_REGNUM; | |
120 | regno < NUM_REGS; | |
121 | regno++, regaddr += 16) | |
122 | { | |
123 | X_REGISTER_RAW_TYPE xval; | |
124 | ||
39f77062 | 125 | *(int *) &xval.w1 = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b | 126 | (PTRACE_ARG3_TYPE) regaddr, 0); |
39f77062 | 127 | *(int *) &xval.w2 = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b | 128 | (PTRACE_ARG3_TYPE) (regaddr + 4), 0); |
39f77062 | 129 | *(int *) &xval.w3 = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b | 130 | (PTRACE_ARG3_TYPE) (regaddr + 8), 0); |
39f77062 | 131 | *(int *) &xval.w4 = ptrace (3, PIDGET (inferior_ptid), |
c5aa993b JM |
132 | (PTRACE_ARG3_TYPE) (regaddr + 12), 0); |
133 | supply_register (regno, (void *) &xval); | |
134 | } | |
135 | } | |
c906108c SS |
136 | } |
137 | ||
138 | /* Store our register values back into the inferior. | |
139 | If REGNO is -1, do this for all registers. | |
140 | Otherwise, REGNO specifies which register (so we can save time). */ | |
141 | ||
142 | void | |
fba45db2 | 143 | store_inferior_registers (int regno) |
c906108c SS |
144 | { |
145 | register unsigned int regaddr; | |
146 | char buf[80]; | |
147 | ||
148 | struct USER u; | |
149 | ||
150 | unsigned int offset = (char *) &u.pt_r0 - (char *) &u; | |
151 | ||
152 | regaddr = offset; | |
153 | ||
154 | /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either | |
155 | svr3 doesn't run on an 88110, or the kernel isolates the different (not | |
156 | completely sure this is true, but seems to be. */ | |
157 | if (regno >= 0) | |
158 | { | |
159 | /* regaddr = register_addr (regno, offset); */ | |
160 | if (regno < PC_REGNUM) | |
c5aa993b | 161 | { |
c906108c SS |
162 | regaddr = offset + regno * sizeof (int); |
163 | errno = 0; | |
39f77062 | 164 | ptrace (6, PIDGET (inferior_ptid), |
c906108c SS |
165 | (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); |
166 | if (errno != 0) | |
167 | { | |
168 | sprintf (buf, "writing register number %d", regno); | |
169 | perror_with_name (buf); | |
170 | } | |
171 | } | |
172 | else if (regno == PSR_REGNUM) | |
39f77062 | 173 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 174 | (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno)); |
c906108c | 175 | else if (regno == FPSR_REGNUM) |
39f77062 | 176 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 177 | (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno)); |
c906108c | 178 | else if (regno == FPCR_REGNUM) |
39f77062 | 179 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 180 | (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno)); |
c906108c | 181 | else if (regno == SXIP_REGNUM) |
39f77062 | 182 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 183 | (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno)); |
c906108c | 184 | else if (regno == SNIP_REGNUM) |
39f77062 | 185 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 186 | (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno)); |
c906108c | 187 | else if (regno == SFIP_REGNUM) |
39f77062 | 188 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 189 | (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno)); |
c906108c | 190 | else if (target_is_m88110 && regno < NUM_REGS) |
c5aa993b JM |
191 | { |
192 | X_REGISTER_RAW_TYPE xval; | |
193 | ||
194 | read_register_bytes (REGISTER_BYTE (regno), (char *) &xval, | |
195 | sizeof (X_REGISTER_RAW_TYPE)); | |
196 | regaddr = XREGADDR (regno); | |
39f77062 KB |
197 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1); |
198 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 4, xval.w2); | |
199 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 8, xval.w3); | |
200 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 12, xval.w4); | |
c5aa993b | 201 | } |
c906108c SS |
202 | else |
203 | printf_unfiltered ("Bad register number for store_inferior routine\n"); | |
204 | } | |
205 | else | |
c5aa993b | 206 | { |
c906108c SS |
207 | for (regno = 0; regno < PC_REGNUM; regno++) |
208 | { | |
209 | /* regaddr = register_addr (regno, offset); */ | |
210 | errno = 0; | |
211 | regaddr = offset + regno * sizeof (int); | |
39f77062 | 212 | ptrace (6, PIDGET (inferior_ptid), |
c906108c SS |
213 | (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); |
214 | if (errno != 0) | |
215 | { | |
216 | sprintf (buf, "writing register number %d", regno); | |
217 | perror_with_name (buf); | |
218 | } | |
219 | } | |
39f77062 | 220 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 221 | (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno)); |
39f77062 | 222 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 223 | (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno)); |
39f77062 | 224 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 225 | (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno)); |
39f77062 | 226 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 227 | (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM)); |
39f77062 | 228 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 229 | (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM)); |
39f77062 | 230 | ptrace (6, PIDGET (inferior_ptid), |
c5aa993b | 231 | (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM)); |
c906108c | 232 | if (target_is_m88110) |
c5aa993b JM |
233 | { |
234 | for (regno = X0_REGNUM; regno < NUM_REGS; regno++) | |
235 | { | |
236 | X_REGISTER_RAW_TYPE xval; | |
237 | ||
238 | read_register_bytes (REGISTER_BYTE (regno), (char *) &xval, | |
239 | sizeof (X_REGISTER_RAW_TYPE)); | |
240 | regaddr = XREGADDR (regno); | |
39f77062 KB |
241 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1); |
242 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 4), xval.w2); | |
243 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 8), xval.w3); | |
244 | ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 12), xval.w4); | |
c5aa993b JM |
245 | } |
246 | } | |
c906108c SS |
247 | } |
248 | } | |
249 | ||
250 | /* blockend is the address of the end of the user structure */ | |
251 | ||
fba45db2 | 252 | m88k_register_u_addr (int blockend, int regnum) |
c906108c SS |
253 | { |
254 | struct USER u; | |
255 | int ustart = blockend - sizeof (struct USER); | |
256 | ||
257 | if (regnum < PSR_REGNUM) | |
c5aa993b JM |
258 | return (ustart + ((int) &u.pt_r0 - (int) &u) + |
259 | REGISTER_SIZE * regnum); | |
c906108c | 260 | else if (regnum == PSR_REGNUM) |
c5aa993b | 261 | return (ustart + ((int) &u.pt_psr) - (int) &u); |
c906108c | 262 | else if (regnum == FPSR_REGNUM) |
c5aa993b | 263 | return (ustart + ((int) &u.pt_fpsr) - (int) &u); |
c906108c | 264 | else if (regnum == FPCR_REGNUM) |
c5aa993b | 265 | return (ustart + ((int) &u.pt_fpcr) - (int) &u); |
c906108c | 266 | else if (regnum == SXIP_REGNUM) |
c5aa993b | 267 | return (ustart + SXIP_OFFSET); |
c906108c | 268 | else if (regnum == SNIP_REGNUM) |
c5aa993b | 269 | return (ustart + SNIP_OFFSET); |
c906108c | 270 | else if (regnum == SFIP_REGNUM) |
c5aa993b JM |
271 | return (ustart + SFIP_OFFSET); |
272 | else if (target_is_m88110) | |
273 | return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */ | |
274 | sizeof (u.pt_x0) * (regnum - X0_REGNUM)); | |
c906108c | 275 | else |
c5aa993b | 276 | return (blockend + REGISTER_SIZE * regnum); |
c906108c SS |
277 | } |
278 | ||
279 | #ifdef USE_PROC_FS | |
280 | ||
281 | #include <sys/procfs.h> | |
282 | ||
c60c0f5f MS |
283 | /* Prototypes for supply_gregset etc. */ |
284 | #include "gregset.h" | |
285 | ||
c906108c | 286 | /* Given a pointer to a general register set in /proc format (gregset_t *), |
c5aa993b JM |
287 | unpack the register contents and supply them as gdb's idea of the current |
288 | register values. */ | |
c906108c SS |
289 | |
290 | void | |
fba45db2 | 291 | supply_gregset (gregset_t *gregsetp) |
c906108c | 292 | { |
c5aa993b JM |
293 | register int regi; |
294 | register greg_t *regp = (greg_t *) gregsetp; | |
295 | ||
296 | for (regi = 0; regi <= SP_REGNUM; regi++) | |
297 | supply_register (regi, (char *) (regp + regi)); | |
298 | ||
299 | supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); | |
300 | supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); | |
301 | supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); | |
302 | supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); | |
303 | supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); | |
304 | supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); | |
c906108c SS |
305 | } |
306 | ||
307 | void | |
fba45db2 | 308 | fill_gregset (gregset_t *gregsetp, int regno) |
c906108c | 309 | { |
c5aa993b JM |
310 | int regi; |
311 | register greg_t *regp = (greg_t *) gregsetp; | |
312 | ||
313 | for (regi = 0; regi <= R_R31; regi++) | |
314 | if ((regno == -1) || (regno == regi)) | |
315 | *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; | |
316 | ||
317 | if ((regno == -1) || (regno == SXIP_REGNUM)) | |
318 | *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)]; | |
319 | if ((regno == -1) || (regno == SNIP_REGNUM)) | |
320 | *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)]; | |
321 | if ((regno == -1) || (regno == SFIP_REGNUM)) | |
322 | *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)]; | |
323 | if ((regno == -1) || (regno == PSR_REGNUM)) | |
324 | *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)]; | |
325 | if ((regno == -1) || (regno == FPSR_REGNUM)) | |
326 | *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)]; | |
327 | if ((regno == -1) || (regno == FPCR_REGNUM)) | |
328 | *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)]; | |
c906108c SS |
329 | } |
330 | ||
331 | #endif /* USE_PROC_FS */ | |
332 | ||
333 | /* This support adds the equivalent of adb's % command. When | |
334 | the `add-shared-symbol-files' command is given, this routine scans | |
335 | the dynamic linker's link map and reads the minimal symbols | |
336 | from each shared object file listed in the map. */ | |
337 | ||
c5aa993b JM |
338 | struct link_map |
339 | { | |
c906108c SS |
340 | unsigned long l_addr; /* address at which object is mapped */ |
341 | char *l_name; /* full name of loaded object */ | |
342 | void *l_ld; /* dynamic structure of object */ | |
343 | struct link_map *l_next; /* next link object */ | |
344 | struct link_map *l_prev; /* previous link object */ | |
345 | }; | |
346 | ||
347 | #define LINKS_MAP_POINTER "_ld_tail" | |
348 | #define LIBC_FILE "/usr/lib/libc.so.1" | |
349 | #define SHARED_OFFSET 0xf0001000 | |
350 | ||
351 | #ifndef PATH_MAX | |
352 | #define PATH_MAX 1023 /* maximum size of path name on OS */ | |
353 | #endif | |
354 | ||
355 | void | |
fba45db2 | 356 | add_shared_symbol_files (void) |
c906108c SS |
357 | { |
358 | void *desc; | |
359 | struct link_map *ld_map, *lm, lms; | |
c5aa993b | 360 | struct minimal_symbol *minsym; |
c906108c SS |
361 | struct objfile *objfile; |
362 | char *path_name; | |
363 | ||
39f77062 | 364 | if (ptid_equal (inferior_ptid, null_ptid)) |
c906108c SS |
365 | { |
366 | warning ("The program has not yet been started."); | |
367 | return; | |
368 | } | |
369 | ||
2df3850c | 370 | objfile = symbol_file_add (LIBC_FILE, 0, NULL, 0, OBJF_READNOW); |
c906108c SS |
371 | minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile); |
372 | ||
373 | ld_map = (struct link_map *) | |
c5aa993b | 374 | read_memory_integer (((int) SYMBOL_VALUE_ADDRESS (minsym) + SHARED_OFFSET), 4); |
c906108c SS |
375 | lm = ld_map; |
376 | while (lm) | |
377 | { | |
378 | int local_errno = 0; | |
379 | ||
c5aa993b | 380 | read_memory ((CORE_ADDR) lm, (char *) &lms, sizeof (struct link_map)); |
c906108c SS |
381 | if (lms.l_name) |
382 | { | |
c5aa993b JM |
383 | if (target_read_string ((CORE_ADDR) lms.l_name, &path_name, |
384 | PATH_MAX, &local_errno)) | |
c906108c | 385 | { |
2acceee2 JM |
386 | struct section_addr_info section_addrs; |
387 | memset (§ion_addrs, 0, sizeof (section_addrs)); | |
a034fba4 EZ |
388 | section_addrs.other[0].addr = lms.l_addr; |
389 | section_addrs.other[0].name = ".text"; | |
2df3850c | 390 | symbol_file_add (path_name, 1, §ion_addrs, 0, 0); |
b8c9b27d | 391 | xfree (path_name); |
c906108c SS |
392 | } |
393 | } | |
394 | /* traverse links in reverse order so that we get the | |
c5aa993b | 395 | the symbols the user actually gets. */ |
c906108c SS |
396 | lm = lms.l_prev; |
397 | } | |
398 | ||
399 | /* Getting new symbols may change our opinion about what is | |
400 | frameless. */ | |
401 | reinit_frame_cache (); | |
402 | } | |
403 | ||
404 | #if defined(_ES_MP) | |
405 | ||
406 | #include <sys/regset.h> | |
407 | ||
408 | unsigned int | |
fba45db2 | 409 | m88k_harris_core_register_addr (int regno, int reg_ptr) |
c906108c | 410 | { |
c5aa993b JM |
411 | unsigned int word_offset; |
412 | ||
413 | switch (regno) | |
414 | { | |
415 | case PSR_REGNUM: | |
416 | word_offset = R_EPSR; | |
417 | break; | |
418 | case FPSR_REGNUM: | |
419 | word_offset = R_FPSR; | |
420 | break; | |
421 | case FPCR_REGNUM: | |
422 | word_offset = R_FPCR; | |
423 | break; | |
424 | case SXIP_REGNUM: | |
425 | word_offset = R_EXIP; | |
426 | break; | |
427 | case SNIP_REGNUM: | |
428 | word_offset = R_ENIP; | |
429 | break; | |
430 | case SFIP_REGNUM: | |
431 | word_offset = R_EFIP; | |
432 | break; | |
433 | default: | |
434 | if (regno <= FP_REGNUM) | |
435 | word_offset = regno; | |
436 | else | |
437 | word_offset = ((regno - X0_REGNUM) * 4); | |
438 | } | |
439 | return (word_offset * 4); | |
c906108c SS |
440 | } |
441 | ||
442 | #endif /* _ES_MP */ | |
443 | ||
444 | void | |
fba45db2 | 445 | _initialize_m88k_nat (void) |
c906108c SS |
446 | { |
447 | #ifdef _ES_MP | |
c5aa993b | 448 | /* Enable 88110 support, as we don't support the 88100 under ES/MP. */ |
c906108c | 449 | |
c5aa993b | 450 | target_is_m88110 = 1; |
c906108c | 451 | #elif defined(_CX_UX) |
c5aa993b JM |
452 | /* Determine whether we're running on an 88100 or an 88110. */ |
453 | target_is_m88110 = (sinfo (SYSMACHINE, 0) == SYS5800); | |
c906108c SS |
454 | #endif /* _CX_UX */ |
455 | } | |
456 | ||
457 | #ifdef _ES_MP | |
458 | /* Given a pointer to a general register set in /proc format (gregset_t *), | |
459 | unpack the register contents and supply them as gdb's idea of the current | |
460 | register values. */ | |
461 | ||
462 | void | |
fba45db2 | 463 | supply_gregset (gregset_t *gregsetp) |
c906108c SS |
464 | { |
465 | register int regi; | |
466 | register greg_t *regp = (greg_t *) gregsetp; | |
467 | ||
c5aa993b | 468 | for (regi = 0; regi < R_R31; regi++) |
c906108c SS |
469 | { |
470 | supply_register (regi, (char *) (regp + regi)); | |
471 | } | |
c5aa993b | 472 | supply_register (PSR_REGNUM, (char *) (regp + R_EPSR)); |
c906108c SS |
473 | supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); |
474 | supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); | |
475 | supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP)); | |
476 | supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP)); | |
477 | supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP)); | |
478 | } | |
479 | ||
480 | /* Given a pointer to a floating point register set in /proc format | |
481 | (fpregset_t *), unpack the register contents and supply them as gdb's | |
482 | idea of the current floating point register values. */ | |
483 | ||
c5aa993b | 484 | void |
fba45db2 | 485 | supply_fpregset (fpregset_t *fpregsetp) |
c906108c SS |
486 | { |
487 | register int regi; | |
488 | char *from; | |
c5aa993b JM |
489 | |
490 | for (regi = FP0_REGNUM; regi <= FPLAST_REGNUM; regi++) | |
c906108c | 491 | { |
c5aa993b | 492 | from = (char *) &((*fpregsetp)[regi - FP0_REGNUM]); |
c906108c SS |
493 | supply_register (regi, from); |
494 | } | |
495 | } | |
496 | ||
497 | #endif /* _ES_MP */ | |
498 | ||
499 | #ifdef _CX_UX | |
500 | ||
501 | #include <sys/regset.h> | |
502 | ||
c5aa993b JM |
503 | unsigned int |
504 | m88k_harris_core_register_addr (int regno, int reg_ptr) | |
c906108c | 505 | { |
c5aa993b JM |
506 | unsigned int word_offset; |
507 | ||
508 | switch (regno) | |
509 | { | |
510 | case PSR_REGNUM: | |
511 | word_offset = R_PSR; | |
512 | break; | |
513 | case FPSR_REGNUM: | |
514 | word_offset = R_FPSR; | |
515 | break; | |
516 | case FPCR_REGNUM: | |
517 | word_offset = R_FPCR; | |
518 | break; | |
519 | case SXIP_REGNUM: | |
520 | word_offset = R_XIP; | |
521 | break; | |
522 | case SNIP_REGNUM: | |
523 | word_offset = R_NIP; | |
524 | break; | |
525 | case SFIP_REGNUM: | |
526 | word_offset = R_FIP; | |
527 | break; | |
528 | default: | |
529 | if (regno <= FP_REGNUM) | |
530 | word_offset = regno; | |
531 | else | |
532 | word_offset = ((regno - X0_REGNUM) * 4) + R_X0; | |
533 | } | |
534 | return (word_offset * 4); | |
c906108c SS |
535 | } |
536 | ||
537 | #endif /* _CX_UX */ |