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