]>
Commit | Line | Data |
---|---|---|
598db9ee FF |
1 | /* Functions specific to running gdb native on a Motorola Delta Series sysV68. |
2 | Copyright (C) 1993, Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
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. | |
10 | ||
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. | |
15 | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
c649a7c2 JK |
20 | #include "defs.h" |
21 | #include <sys/signal.h> /* for MAXSIG in sys/user.h */ | |
22 | #include <sys/types.h> /* for ushort in sys/dir.h */ | |
23 | #include <sys/dir.h> /* for struct direct in sys/user.h */ | |
24 | #include <sys/user.h> | |
25 | ||
26 | #include <nlist.h> | |
27 | ||
28 | #if !defined (offsetof) | |
29 | #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) | |
30 | #endif | |
31 | ||
32 | /* Return the address in the core dump or inferior of register REGNO. | |
33 | BLOCKEND is the address of the end of the user structure. */ | |
34 | ||
35 | unsigned int | |
36 | register_addr (regno, blockend) | |
37 | int regno; | |
38 | int blockend; | |
39 | { | |
40 | static int sysv68reg[] = | |
41 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, 15, 16 }; | |
42 | ||
43 | if (regno >= 0 && regno < sizeof(sysv68reg) / sizeof(sysv68reg[0])) | |
44 | return blockend + sysv68reg[regno] * 4; | |
45 | else if (regno < FPC_REGNUM) | |
66e8e483 | 46 | return offsetof (struct user, u_fpu.regs.reg[regno - FP0_REGNUM][0]); |
c649a7c2 JK |
47 | else if (regno == FPC_REGNUM) |
48 | return offsetof (struct user, u_fpu.regs.control); | |
49 | else if (regno == FPS_REGNUM) | |
50 | return offsetof (struct user, u_fpu.regs.status); | |
51 | else if (regno == FPI_REGNUM) | |
52 | return offsetof (struct user, u_fpu.regs.iaddr); | |
53 | else | |
54 | { | |
199b2450 | 55 | fprintf_unfiltered (gdb_stderr, "\ |
c649a7c2 JK |
56 | Internal error: invalid register number %d in REGISTER_U_ADDR\n", |
57 | regno); | |
58 | return blockend; | |
59 | } | |
60 | } | |
61 | ||
62 | CORE_ADDR kernel_u_addr; | |
c649a7c2 JK |
63 | |
64 | /* Read the value of the u area from the kernel. */ | |
976bb0be JK |
65 | void |
66 | _initialize_delta68_nat () | |
c649a7c2 | 67 | { |
66e8e483 | 68 | struct nlist nl[2]; |
522b9962 JK |
69 | |
70 | nl[0].n_name = "u"; | |
71 | nl[1].n_name = NULL; | |
72 | if (nlist ("/sysV68", nl) == 0 && nl[0].n_scnum != 0) | |
c649a7c2 JK |
73 | kernel_u_addr = nl[0].n_value; |
74 | else | |
75 | { | |
76 | perror ("Cannot get kernel u area address"); | |
77 | exit (1); | |
78 | } | |
79 | } |