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