1 |
578 |
markom |
/* Parameters for Hewlett-Packard 9000/300 native support under bsd.
|
2 |
|
|
Copyright 1986, 1987, 1989, 1991, 1992, 1993
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GDB.
|
6 |
|
|
|
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.
|
11 |
|
|
|
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.
|
16 |
|
|
|
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. */
|
21 |
|
|
|
22 |
|
|
/* Detect whether this is 4.3 or 4.4. */
|
23 |
|
|
|
24 |
|
|
#include <errno.h>
|
25 |
|
|
#include <sys/param.h>
|
26 |
|
|
#ifdef BSD4_4
|
27 |
|
|
|
28 |
|
|
/* BSD 4.4 alpha or better */
|
29 |
|
|
|
30 |
|
|
/* We can attach to processes using ptrace. */
|
31 |
|
|
|
32 |
|
|
#define ATTACH_DETACH
|
33 |
|
|
#define PTRACE_ATTACH 10
|
34 |
|
|
#define PTRACE_DETACH 11
|
35 |
|
|
|
36 |
|
|
/* The third argument of ptrace is declared as this type. */
|
37 |
|
|
|
38 |
|
|
#define PTRACE_ARG3_TYPE caddr_t
|
39 |
|
|
|
40 |
|
|
/* U_REGS_OFFSET is the offset of the registers within the u area for
|
41 |
|
|
ptrace purposes. */
|
42 |
|
|
#define U_REGS_OFFSET \
|
43 |
|
|
ptrace (PT_READ_U, PIDGET (inferior_ptid), \
|
44 |
|
|
(PTRACE_ARG3_TYPE) \
|
45 |
|
|
(offsetof (struct user, u_kproc.kp_proc.p_md.md_regs)), 0) \
|
46 |
|
|
- USRSTACK
|
47 |
|
|
|
48 |
|
|
/* No user structure in 4.4, registers are relative to kernel stack
|
49 |
|
|
which is fixed. */
|
50 |
|
|
#define KERNEL_U_ADDR 0xFFF00000
|
51 |
|
|
|
52 |
|
|
/* FIXME: Is ONE_PROCESS_WRITETEXT still true now that the kernel has
|
53 |
|
|
copy-on-write? It not, move it to the 4.3-specific section below
|
54 |
|
|
(now it is in xm-hp300bsd.h). */
|
55 |
|
|
|
56 |
|
|
#else
|
57 |
|
|
|
58 |
|
|
/* This is BSD 4.3 or something like it. */
|
59 |
|
|
|
60 |
|
|
/* Get kernel u area address at run-time using BSD style nlist (). */
|
61 |
|
|
#define KERNEL_U_ADDR_BSD
|
62 |
|
|
|
63 |
|
|
#endif
|
64 |
|
|
|
65 |
|
|
/* This was once broken for 4.4, but probably because we had the wrong
|
66 |
|
|
KERNEL_U_ADDR. */
|
67 |
|
|
|
68 |
|
|
/* This is a piece of magic that is given a register number REGNO
|
69 |
|
|
and as BLOCKEND the address in the system of the end of the user structure
|
70 |
|
|
and stores in ADDR the address in the kernel or core dump
|
71 |
|
|
of that register. */
|
72 |
|
|
|
73 |
|
|
#define REGISTER_U_ADDR(addr, blockend, regno) \
|
74 |
|
|
{ \
|
75 |
|
|
if (regno < PS_REGNUM) \
|
76 |
|
|
addr = (int) &((struct frame *)(blockend))->f_regs[regno]; \
|
77 |
|
|
else if (regno == PS_REGNUM) \
|
78 |
|
|
addr = (int) &((struct frame *)(blockend))->f_stackadj; \
|
79 |
|
|
else if (regno == PC_REGNUM) \
|
80 |
|
|
addr = (int) &((struct frame *)(blockend))->f_pc; \
|
81 |
|
|
else if (regno < FPC_REGNUM) \
|
82 |
|
|
addr = (int) \
|
83 |
|
|
&((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\
|
84 |
|
|
else if (regno == FPC_REGNUM) \
|
85 |
|
|
addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr; \
|
86 |
|
|
else if (regno == FPS_REGNUM) \
|
87 |
|
|
addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr; \
|
88 |
|
|
else \
|
89 |
|
|
addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar; \
|
90 |
|
|
}
|