]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Functions specific to running gdb native on a Motorola Delta Series sysV68. |
2 | Copyright (C) 1993, 1997-98, Free Software Foundation, Inc. | |
3 | ||
c5aa993b | 4 | This file is part of GDB. |
c906108c | 5 | |
c5aa993b JM |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
c906108c | 10 | |
c5aa993b JM |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
c906108c | 15 | |
c5aa993b JM |
16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
20 | |
21 | #include "defs.h" | |
c5aa993b JM |
22 | #include <sys/signal.h> /* for MAXSIG in sys/user.h */ |
23 | #include <sys/types.h> /* for ushort in sys/dir.h */ | |
24 | #include <sys/dir.h> /* for struct direct in sys/user.h */ | |
c906108c SS |
25 | #include <sys/user.h> |
26 | ||
27 | #include <nlist.h> | |
28 | ||
29 | #if !defined (offsetof) | |
30 | #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) | |
31 | #endif | |
32 | ||
33 | /* Return the address in the core dump or inferior of register REGNO. | |
34 | BLOCKEND is the address of the end of the user structure. */ | |
35 | ||
36 | CORE_ADDR | |
fba45db2 | 37 | register_addr (int regno, CORE_ADDR blockend) |
c906108c | 38 | { |
c5aa993b JM |
39 | static int sysv68reg[] = |
40 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, 15, 16}; | |
c906108c | 41 | |
c5aa993b JM |
42 | if (regno >= 0 && regno < sizeof (sysv68reg) / sizeof (sysv68reg[0])) |
43 | return blockend + sysv68reg[regno] * 4; | |
c906108c SS |
44 | else if (regno < FPC_REGNUM) |
45 | return offsetof (struct user, u_fpu.regs.reg[regno - FP0_REGNUM][0]); | |
46 | else if (regno == FPC_REGNUM) | |
47 | return offsetof (struct user, u_fpu.regs.control); | |
48 | else if (regno == FPS_REGNUM) | |
49 | return offsetof (struct user, u_fpu.regs.status); | |
50 | else if (regno == FPI_REGNUM) | |
51 | return offsetof (struct user, u_fpu.regs.iaddr); | |
52 | else | |
53 | { | |
54 | fprintf_unfiltered (gdb_stderr, "\ | |
55 | Internal error: invalid register number %d in REGISTER_U_ADDR\n", | |
c5aa993b | 56 | regno); |
c906108c SS |
57 | return blockend; |
58 | } | |
59 | } | |
60 | ||
61 | CORE_ADDR kernel_u_addr; | |
62 | ||
63 | /* Read the value of the u area from the kernel. */ | |
64 | void | |
fba45db2 | 65 | _initialize_delta68_nat (void) |
c906108c SS |
66 | { |
67 | struct nlist nl[2]; | |
68 | ||
69 | nl[0].n_name = "u"; | |
70 | nl[1].n_name = NULL; | |
71 | if (nlist ("/sysV68", nl) == 0 && nl[0].n_scnum != 0) | |
72 | kernel_u_addr = nl[0].n_value; | |
73 | else | |
74 | { | |
75 | perror ("Cannot get kernel u area address"); | |
76 | exit (1); | |
77 | } | |
78 | } | |
79 | ||
fba45db2 | 80 | clear_insn_cache (void) |
c906108c | 81 | { |
c5aa993b JM |
82 | #ifdef MCT_TEXT /* in sys/signal.h on sysV68 R3V7.1 */ |
83 | memctl (0, 4096, MCT_TEXT); | |
c906108c SS |
84 | #endif |
85 | } | |
86 | ||
fba45db2 | 87 | kernel_u_size (void) |
c906108c SS |
88 | { |
89 | return sizeof (struct user); | |
90 | } |