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