Commit | Line | Data |
---|---|---|
c906108c | 1 | /* DPX2 host interface. |
b6ba6518 KB |
2 | Copyright 1988, 1989, 1991, 1993, 1995, 2000 |
3 | 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 "gdbcore.h" | |
24 | ||
25 | #include "gdb_string.h" | |
26 | #include <sys/types.h> | |
27 | #include <sys/param.h> | |
28 | #include <sys/dir.h> | |
29 | #include <signal.h> | |
30 | #include <sys/user.h> | |
31 | #include <sys/reg.h> | |
32 | #include <sys/utsname.h> | |
c906108c | 33 | \f |
c5aa993b | 34 | |
c906108c SS |
35 | /* this table must line up with REGISTER_NAMES in tm-68k.h */ |
36 | /* symbols like 'A0' come from <sys/reg.h> */ | |
c5aa993b | 37 | static int regmap[] = |
c906108c SS |
38 | { |
39 | R0, R1, R2, R3, R4, R5, R6, R7, | |
40 | A0, A1, A2, A3, A4, A5, A6, SP, | |
41 | PS, PC, | |
42 | FP0, FP1, FP2, FP3, FP4, FP5, FP6, FP7, | |
43 | FP_CR, FP_SR, FP_IAR | |
44 | }; | |
45 | ||
46 | /* blockend is the value of u.u_ar0, and points to the | |
47 | * place where D0 is stored | |
48 | */ | |
49 | ||
50 | int | |
fba45db2 | 51 | dpx2_register_u_addr (int blockend, int regnum) |
c906108c SS |
52 | { |
53 | if (regnum < FP0_REGNUM) | |
54 | return (blockend + 4 * regmap[regnum]); | |
55 | else | |
c5aa993b | 56 | return (int) &(((struct user *) 0)->u_fpstate[regmap[regnum]]); |
c906108c SS |
57 | } |
58 | ||
59 | /* This is the amount to subtract from u.u_ar0 | |
60 | to get the offset in the core file of the register values. | |
61 | Unfortunately this is not provided in the system header files. | |
62 | To make matters worse, this value also differs between | |
63 | the dpx/2200 and dpx/2300 models and nlist is not available on the dpx2. | |
64 | We use utsname() to decide on which model we are running. | |
65 | FIXME: This breaks cross examination of core files (it would not be hard | |
66 | to check whether u.u_ar0 is between 0x7fff5000 and 0x7fffc000 and if so | |
67 | use 0x7fff5000 and if not use 0x7fffc000. FIXME). */ | |
68 | ||
69 | #define KERNEL_U_ADDR_200 0x7fff5000 | |
70 | #define KERNEL_U_ADDR_300 0x7fffc000 | |
71 | ||
72 | CORE_ADDR kernel_u_addr; | |
73 | ||
74 | void | |
fba45db2 | 75 | _initialize_dpx2_nat (void) |
c906108c SS |
76 | { |
77 | struct utsname uts; | |
78 | ||
79 | if (uname (&uts) == 0 && strcmp (uts.machine, "DPX/2200") == 0) | |
80 | kernel_u_addr = KERNEL_U_ADDR_200; | |
81 | else | |
82 | kernel_u_addr = KERNEL_U_ADDR_300; | |
83 | } |