Commit | Line | Data |
---|---|---|
56056df7 AC |
1 | // OBSOLETE /* HPPA PA-RISC machine native support for BSD, for GDB. |
2 | // OBSOLETE Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc. | |
3 | // OBSOLETE | |
4 | // OBSOLETE This file is part of GDB. | |
5 | // OBSOLETE | |
6 | // OBSOLETE This program is free software; you can redistribute it and/or modify | |
7 | // OBSOLETE it under the terms of the GNU General Public License as published by | |
8 | // OBSOLETE the Free Software Foundation; either version 2 of the License, or | |
9 | // OBSOLETE (at your option) any later version. | |
10 | // OBSOLETE | |
11 | // OBSOLETE This program is distributed in the hope that it will be useful, | |
12 | // OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // OBSOLETE GNU General Public License for more details. | |
15 | // OBSOLETE | |
16 | // OBSOLETE You should have received a copy of the GNU General Public License | |
17 | // OBSOLETE along with this program; if not, write to the Free Software | |
18 | // OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | // OBSOLETE Boston, MA 02111-1307, USA. */ | |
20 | // OBSOLETE | |
21 | // OBSOLETE #include "somsolib.h" | |
22 | // OBSOLETE #include "regcache.h" | |
23 | // OBSOLETE | |
24 | // OBSOLETE #define U_REGS_OFFSET 0 | |
25 | // OBSOLETE | |
26 | // OBSOLETE #define KERNEL_U_ADDR 0 | |
27 | // OBSOLETE | |
28 | // OBSOLETE /* What a coincidence! */ | |
29 | // OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
30 | // OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);} | |
31 | // OBSOLETE | |
32 | // OBSOLETE /* 3rd argument to ptrace is supposed to be a caddr_t. */ | |
33 | // OBSOLETE | |
34 | // OBSOLETE #define PTRACE_ARG3_TYPE caddr_t | |
35 | // OBSOLETE | |
36 | // OBSOLETE /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace | |
37 | // OBSOLETE with five arguments, so programs written for normal ptrace lose. */ | |
38 | // OBSOLETE #define FIVE_ARG_PTRACE | |
39 | // OBSOLETE | |
40 | // OBSOLETE | |
41 | // OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */ | |
42 | // OBSOLETE #define FETCH_INFERIOR_REGISTERS | |
43 | // OBSOLETE | |
44 | // OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long | |
45 | // OBSOLETE as the process you're attaching to isn't blocked waiting on io, | |
46 | // OBSOLETE blocked waiting on a signal, or in a system call things work | |
47 | // OBSOLETE fine. (The problems in those cases are related to the fact that | |
48 | // OBSOLETE the kernel can't provide complete register information for the | |
49 | // OBSOLETE target process... Which really pisses off GDB.) */ | |
50 | // OBSOLETE | |
51 | // OBSOLETE #define ATTACH_DETACH | |
52 | // OBSOLETE | |
53 | // OBSOLETE /* The PA-BSD kernel has support for using the data memory break bit | |
54 | // OBSOLETE to implement fast watchpoints. | |
55 | // OBSOLETE | |
56 | // OBSOLETE Watchpoints on the PA act much like traditional page protection | |
57 | // OBSOLETE schemes, but with some notable differences. | |
58 | // OBSOLETE | |
59 | // OBSOLETE First, a special bit in the page table entry is used to cause | |
60 | // OBSOLETE a trap when a specific page is written to. This avoids having | |
61 | // OBSOLETE to overload watchpoints on the page protection bits. This makes | |
62 | // OBSOLETE it possible for the kernel to easily decide if a trap was caused | |
63 | // OBSOLETE by a watchpoint or by the user writing to protected memory and can | |
64 | // OBSOLETE signal the user program differently in each case. | |
65 | // OBSOLETE | |
66 | // OBSOLETE Second, the PA has a bit in the processor status word which causes | |
67 | // OBSOLETE data memory breakpoints (aka watchpoints) to be disabled for a single | |
68 | // OBSOLETE instruction. This bit can be used to avoid the overhead of unprotecting | |
69 | // OBSOLETE and reprotecting pages when it becomes necessary to step over a watchpoint. | |
70 | // OBSOLETE | |
71 | // OBSOLETE | |
72 | // OBSOLETE When the kernel receives a trap indicating a write to a page which | |
73 | // OBSOLETE is being watched, the kernel performs a couple of simple actions. First | |
74 | // OBSOLETE is sets the magic "disable memory breakpoint" bit in the processor | |
75 | // OBSOLETE status word, it then sends a SIGTRAP to the process which caused the | |
76 | // OBSOLETE trap. | |
77 | // OBSOLETE | |
78 | // OBSOLETE GDB will take control and catch the signal for the inferior. GDB then | |
79 | // OBSOLETE examines the PSW-X bit to determine if the SIGTRAP was caused by a | |
80 | // OBSOLETE watchpoint firing. If so GDB single steps the inferior over the | |
81 | // OBSOLETE instruction which caused the watchpoint to trigger (note because the | |
82 | // OBSOLETE kernel disabled the data memory break bit for one instruction no trap | |
83 | // OBSOLETE will be taken!). GDB will then determines the appropriate action to | |
84 | // OBSOLETE take. (this may include restarting the inferior if the watchpoint | |
85 | // OBSOLETE fired because of a write to an address on the same page as a watchpoint, | |
86 | // OBSOLETE but no write to the watched address occured). */ | |
87 | // OBSOLETE | |
88 | // OBSOLETE #define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */ | |
89 | // OBSOLETE | |
90 | // OBSOLETE /* The PA can watch any number of locations, there's no need for it to reject | |
91 | // OBSOLETE anything (generic routines already check that all intermediates are | |
92 | // OBSOLETE in memory). */ | |
93 | // OBSOLETE #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \ | |
94 | // OBSOLETE ((type) == bp_hardware_watchpoint) | |
95 | // OBSOLETE | |
96 | // OBSOLETE /* When a hardware watchpoint fires off the PC will be left at the | |
97 | // OBSOLETE instruction which caused the watchpoint. It will be necessary for | |
98 | // OBSOLETE GDB to step over the watchpoint. | |
99 | // OBSOLETE | |
100 | // OBSOLETE On a PA running BSD, it is trivial to identify when it will be | |
101 | // OBSOLETE necessary to step over a hardware watchpoint as we can examine | |
102 | // OBSOLETE the PSW-X bit. If the bit is on, then we trapped because of a | |
103 | // OBSOLETE watchpoint, else we trapped for some other reason. */ | |
104 | // OBSOLETE #define STOPPED_BY_WATCHPOINT(W) \ | |
105 | // OBSOLETE ((W).kind == TARGET_WAITKIND_STOPPED \ | |
106 | // OBSOLETE && (W).value.sig == TARGET_SIGNAL_TRAP \ | |
107 | // OBSOLETE && ((int) read_register (IPSW_REGNUM) & 0x00100000)) | |
108 | // OBSOLETE | |
109 | // OBSOLETE /* The PA can single step over a watchpoint if the kernel has set the | |
110 | // OBSOLETE "X" bit in the processor status word (disable data memory breakpoint | |
111 | // OBSOLETE for one instruction). | |
112 | // OBSOLETE | |
113 | // OBSOLETE The kernel will always set this bit before notifying the inferior | |
114 | // OBSOLETE that it hit a watchpoint. Thus, the inferior can single step over | |
115 | // OBSOLETE the instruction which caused the watchpoint to fire. This avoids | |
116 | // OBSOLETE the traditional need to disable the watchpoint, step the inferior, | |
117 | // OBSOLETE then enable the watchpoint again. */ | |
118 | // OBSOLETE #define HAVE_STEPPABLE_WATCHPOINT | |
119 | // OBSOLETE | |
120 | // OBSOLETE /* Use these macros for watchpoint insertion/deletion. */ | |
121 | // OBSOLETE /* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */ | |
122 | // OBSOLETE #define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1) | |
123 | // OBSOLETE #define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0) |