Commit | Line | Data |
---|---|---|
b1de302a | 1 | /* Parameters for Hewlett-Packard 9000/300 native support under bsd. |
aea94564 | 2 | Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. |
b1de302a RP |
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., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
5e3d0ab0 JG |
20 | /* This is a hack. This is only a hack. Were this a common source file, |
21 | rather than a config file specific to BSD on HP 68k's, you would have | |
22 | been instructed to clean this up. As it is, clean it up if FSF's | |
23 | HP's-running-ancient-BSD ever go away. */ | |
24 | ||
25 | #include <errno.h> | |
26 | #ifdef EPROCUNAVAIL | |
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 | /* This is a piece of magic that is given a register number REGNO | |
48 | and as BLOCKEND the address in the system of the end of the user structure | |
49 | and stores in ADDR the address in the kernel or core dump | |
50 | of that register. */ | |
51 | ||
52 | #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
53 | { \ | |
54 | if (regno < PS_REGNUM) \ | |
55 | addr = (int) &((struct frame *)(blockend))->f_regs[regno]; \ | |
56 | else if (regno == PS_REGNUM) \ | |
57 | addr = (int) &((struct frame *)(blockend))->f_stackadj; \ | |
58 | else if (regno == PC_REGNUM) \ | |
59 | addr = (int) &((struct frame *)(blockend))->f_pc; \ | |
60 | else if (regno < FPC_REGNUM) \ | |
61 | addr = (int) \ | |
62 | &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\ | |
63 | else if (regno == FPC_REGNUM) \ | |
64 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr; \ | |
65 | else if (regno == FPS_REGNUM) \ | |
66 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr; \ | |
67 | else \ | |
68 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar; \ | |
69 | } | |
70 | #else | |
71 | ||
72 | /* THIS IS BSD 4.3 or something like it. */ | |
73 | ||
b1de302a RP |
74 | /* This is a piece of magic that is given a register number REGNO |
75 | and as BLOCKEND the address in the system of the end of the user structure | |
76 | and stores in ADDR the address in the kernel or core dump | |
77 | of that register. */ | |
78 | ||
79 | #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
80 | { \ | |
81 | if (regno < PS_REGNUM) \ | |
82 | addr = (int) &((struct frame *)(blockend))->f_regs[regno]; \ | |
83 | else if (regno == PS_REGNUM) \ | |
84 | addr = (int) &((struct frame *)(blockend))->f_stackadj; \ | |
85 | else if (regno == PC_REGNUM) \ | |
86 | addr = (int) &((struct frame *)(blockend))->f_pc; \ | |
87 | else if (regno < FPC_REGNUM) \ | |
88 | addr = (int) \ | |
89 | &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\ | |
90 | else if (regno == FPC_REGNUM) \ | |
91 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr; \ | |
92 | else if (regno == FPS_REGNUM) \ | |
93 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr; \ | |
94 | else \ | |
95 | addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar; \ | |
96 | } | |
add04f8b | 97 | #endif |