Commit | Line | Data |
---|---|---|
adf40b2e | 1 | /* Parameters for execution on any Hewlett-Packard PA-RISC machine. |
b6ba6518 KB |
2 | Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1995, 1999, 2000 |
3 | Free Software Foundation, Inc. | |
adf40b2e JM |
4 | |
5 | Contributed by the Center for Software Science at the | |
6 | University of Utah (pa-gdb-bugs@cs.utah.edu). | |
7 | ||
8 | This file is part of GDB. | |
9 | ||
10 | This program is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 2 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | This program is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
21 | along with this program; if not, write to the Free Software | |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
23 | ||
30e221b4 | 24 | struct type; |
aef9bcd2 | 25 | struct value; |
30e221b4 AC |
26 | struct frame_info; |
27 | ||
adf40b2e JM |
28 | /* PA 64-bit specific definitions. Override those which are in |
29 | tm-hppa.h */ | |
30 | ||
adf40b2e JM |
31 | /* jimb: this must go. I'm just using it to disable code I haven't |
32 | gotten working yet. */ | |
33 | #define GDB_TARGET_IS_HPPA_20W | |
34 | ||
a7e9a47e AC |
35 | /* NOTE: cagney/2003-07-27: Using CC='cc +DA2.0W -Ae' configure |
36 | hppa64-hp-hpux11.00; GDB managed to build / start / break main / | |
37 | run with multi-arch enabled. Not sure about much else as there | |
38 | appears to be an unrelated problem in the SOM symbol table reader | |
d84defb1 | 39 | causing GDB to lose line number information. Since prior to this |
a7e9a47e AC |
40 | switch and a other recent tweaks, 64 bit PA hadn't been building |
41 | for some months, this is probably the lesser of several evils. */ | |
42 | #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL | |
61995b3b | 43 | |
7be570e7 JM |
44 | #include "pa/tm-hppah.h" |
45 | ||
adf40b2e JM |
46 | /* Say how long (ordinary) registers are. This is used in |
47 | push_word and a few other places, but REGISTER_RAW_SIZE is | |
48 | the real way to know how big a register is. */ | |
49 | ||
b1e29e33 AC |
50 | #undef DEPRECATED_REGISTER_SIZE |
51 | #define DEPRECATED_REGISTER_SIZE 8 | |
adf40b2e JM |
52 | |
53 | /* Number of bytes of storage in the actual machine representation | |
54 | for register N. On the PA-RISC 2.0, all regs are 8 bytes, including | |
55 | the FP registers (they're accessed as two 4 byte halves). */ | |
56 | ||
57 | #undef REGISTER_RAW_SIZE | |
58 | #define REGISTER_RAW_SIZE(N) 8 | |
59 | ||
60 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
61 | ||
a0ed5532 AC |
62 | #undef DEPRECATED_MAX_REGISTER_RAW_SIZE |
63 | #define DEPRECATED_MAX_REGISTER_RAW_SIZE 8 | |
adf40b2e JM |
64 | |
65 | /* Total amount of space needed to store our copies of the machine's | |
66 | register state, the array `registers'. */ | |
67 | ||
b8b527c5 AC |
68 | #undef DEPRECATED_REGISTER_BYTES |
69 | #define DEPRECATED_REGISTER_BYTES (NUM_REGS * 8) | |
adf40b2e JM |
70 | |
71 | /* Index within `registers' of the first byte of the space for | |
72 | register N. */ | |
73 | ||
74 | #undef REGISTER_BYTE | |
75 | #define REGISTER_BYTE(N) ((N) * 8) | |
76 | ||
77 | #undef REGISTER_VIRTUAL_TYPE | |
78 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
79 | ((N) < FP4_REGNUM ? builtin_type_unsigned_long_long : builtin_type_double) | |
80 | ||
81 | ||
82 | /* Number of machine registers */ | |
83 | #undef NUM_REGS | |
84 | #define NUM_REGS 96 | |
85 | ||
86 | /* Initializer for an array of names of registers. | |
87 | There should be NUM_REGS strings in this initializer. | |
88 | They are in rows of eight entries */ | |
e23457df AC |
89 | extern const char *hppa64_register_name (int i); |
90 | #define REGISTER_NAME hppa64_register_name | |
adf40b2e JM |
91 | |
92 | #undef FP0_REGNUM | |
93 | #undef FP4_REGNUM | |
94 | #define FP0_REGNUM 64 /* floating point reg. 0 (fspr)*/ | |
95 | #define FP4_REGNUM 68 | |
96 | ||
97 | /* Redefine some target bit sizes from the default. */ | |
98 | ||
99 | /* Number of bits in a long or unsigned long for the target machine. */ | |
100 | ||
101 | #define TARGET_LONG_BIT 64 | |
102 | ||
103 | /* Number of bits in a long long or unsigned long long for the | |
104 | target machine. */ | |
105 | ||
106 | #define TARGET_LONG_LONG_BIT 64 | |
107 | ||
108 | /* Number of bits in a pointer for the target machine */ | |
109 | ||
110 | #define TARGET_PTR_BIT 64 | |
111 | ||
112 | /* Argument Pointer Register */ | |
113 | #define AP_REGNUM 29 | |
114 | ||
115 | #define DP_REGNUM 27 | |
116 | ||
117 | #define FP5_REGNUM 70 | |
118 | ||
119 | #define SR5_REGNUM 48 | |
120 | ||
adf40b2e JM |
121 | /* We access locals from SP. This may not work for frames which call |
122 | alloca; for those, we may need to consult unwind tables. | |
123 | jimb: FIXME. */ | |
42efa47a | 124 | #undef DEPRECATED_FRAME_LOCALS_ADDRESS |
aef9bcd2 | 125 | #define DEPRECATED_FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi)) |
adf40b2e | 126 | |
adf40b2e JM |
127 | /* For a number of horrible reasons we may have to adjust the location |
128 | of variables on the stack. Ugh. jimb: why? */ | |
129 | #define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR) | |
130 | ||
a14ed312 | 131 | extern int hpread_adjust_stack_address (CORE_ADDR); |
adf40b2e JM |
132 | |
133 | ||
134 | /* jimb: omitted dynamic linking stuff here */ | |
135 | ||
136 | /* This sequence of words is the instructions | |
137 | ||
138 | ; Call stack frame has already been built by gdb. Since we could be calling | |
139 | ; a varargs function, and we do not have the benefit of a stub to put things in | |
140 | ; the right place, we load the first 8 word of arguments into both the general | |
141 | ; and fp registers. | |
142 | call_dummy | |
53a5351d | 143 | nop |
adf40b2e JM |
144 | copy %r4,%r29 |
145 | copy %r5,%r22 | |
146 | copy %r6,%r27 | |
147 | fldd -64(0,%r29),%fr4 | |
148 | fldd -56(0,%r29),%fr5 | |
149 | fldd -48(0,%r29),%fr6 | |
150 | fldd -40(0,%r29),%fr7 | |
151 | fldd -32(0,%r29),%fr8 | |
152 | fldd -24(0,%r29),%fr9 | |
153 | fldd -16(0,%r29),%fr10 | |
154 | fldd -8(0,%r29),%fr11 | |
155 | copy %r22,%r1 | |
156 | ldd -64(%r29), %r26 | |
157 | ldd -56(%r29), %r25 | |
158 | ldd -48(%r29), %r24 | |
159 | ldd -40(%r29), %r23 | |
160 | ldd -32(%r29), %r22 | |
161 | ldd -24(%r29), %r21 | |
162 | ldd -16(%r29), %r20 | |
163 | bve,l (%r1),%r2 | |
164 | ldd -8(%r29), %r19 | |
165 | break 4, 8 | |
166 | mtsp %r21, %sr0 | |
167 | ble 0(%sr0, %r22) | |
168 | nop | |
169 | */ | |
170 | ||
53a5351d JM |
171 | /* Call dummys are sized and written out in word sized hunks. So we have |
172 | to pack the instructions into words. Ugh. */ | |
adf40b2e | 173 | #undef CALL_DUMMY |
53a5351d JM |
174 | #define CALL_DUMMY {0x08000240349d0000LL, 0x34b6000034db0000LL, \ |
175 | 0x53a43f8353a53f93LL, 0x53a63fa353a73fb3LL,\ | |
176 | 0x53a83fc353a93fd3LL, 0x2fa1100a2fb1100bLL,\ | |
177 | 0x36c1000053ba3f81LL, 0x53b93f9153b83fa1LL,\ | |
178 | 0x53b73fb153b63fc1LL, 0x53b53fd10fa110d4LL,\ | |
179 | 0xe820f0000fb110d3LL, 0x0001000400151820LL,\ | |
180 | 0xe6c0000008000240LL} | |
181 | ||
b1e29e33 | 182 | #define DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET 22 * 4 |
104c1213 | 183 | |
b1e29e33 AC |
184 | /* DEPRECATED_CALL_DUMMY_LENGTH is computed based on the size of a |
185 | word on the target machine, not the size of an instruction. Since | |
186 | a word on this target holds two instructions we have to divide the | |
187 | instruction size by two to get the word size of the dummy. */ | |
188 | #undef DEPRECATED_CALL_DUMMY_LENGTH | |
189 | #define DEPRECATED_CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 26 / 2) | |
adf40b2e | 190 | |
7be570e7 JM |
191 | /* The PA64 ABI mandates a 16 byte stack alignment. */ |
192 | #undef STACK_ALIGN | |
193 | #define STACK_ALIGN(arg) ( ((arg)%16) ? (((arg)+15)&-16) : (arg)) | |
194 | ||
195 | /* The PA64 ABI reserves 64 bytes of stack space for outgoing register | |
196 | parameters. */ | |
197 | #undef REG_PARM_STACK_SPACE | |
198 | #define REG_PARM_STACK_SPACE 64 | |
199 | ||
c2c6d25f JM |
200 | /* Use the 64-bit calling conventions designed for the PA2.0 in wide mode. */ |
201 | #define PA20W_CALLING_CONVENTIONS | |
53a5351d | 202 | |
adf40b2e JM |
203 | #undef FUNC_LDIL_OFFSET |
204 | #undef FUNC_LDO_OFFSET | |
205 | #undef SR4EXPORT_LDIL_OFFSET | |
206 | #undef SR4EXPORT_LDO_OFFSET | |
7be570e7 | 207 | |
adf40b2e JM |
208 | #undef REG_STRUCT_HAS_ADDR |
209 | ||
26e9b323 | 210 | #undef DEPRECATED_EXTRACT_RETURN_VALUE |
adf40b2e JM |
211 | /* RM: floats are returned in FR4R, doubles in FR4 |
212 | * integral values are in r28, padded on the left | |
213 | * aggregates less that 65 bits are in r28, right padded | |
214 | * aggregates upto 128 bits are in r28 and r29, right padded | |
215 | */ | |
26e9b323 | 216 | #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ |
adf40b2e | 217 | { \ |
77296879 | 218 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ |
adf40b2e JM |
219 | memcpy ((VALBUF), \ |
220 | ((char *)(REGBUF)) + REGISTER_BYTE (FP4_REGNUM) + \ | |
b1e29e33 | 221 | (DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ |
adf40b2e | 222 | TYPE_LENGTH (TYPE)); \ |
77296879 | 223 | else if (is_integral_type(TYPE)) \ |
adf40b2e JM |
224 | memcpy ((VALBUF), \ |
225 | (char *)(REGBUF) + REGISTER_BYTE (28) + \ | |
b1e29e33 | 226 | (DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ |
adf40b2e JM |
227 | TYPE_LENGTH (TYPE)); \ |
228 | else if (TYPE_LENGTH (TYPE) <= 8) \ | |
229 | memcpy ((VALBUF), \ | |
230 | (char *)(REGBUF) + REGISTER_BYTE (28), \ | |
231 | TYPE_LENGTH (TYPE)); \ | |
232 | else if (TYPE_LENGTH (TYPE) <= 16) \ | |
233 | { \ | |
234 | memcpy ((VALBUF), \ | |
235 | (char *)(REGBUF) + REGISTER_BYTE (28), \ | |
236 | 8); \ | |
237 | memcpy (((char *) VALBUF + 8), \ | |
238 | (char *)(REGBUF) + REGISTER_BYTE (29), \ | |
239 | TYPE_LENGTH (TYPE) - 8); \ | |
240 | } \ | |
241 | } | |
242 | ||
243 | /* RM: struct upto 128 bits are returned in registers */ | |
244 | #undef USE_STRUCT_CONVENTION | |
245 | #define USE_STRUCT_CONVENTION(gcc_p, value_type)\ | |
246 | (TYPE_LENGTH (value_type) > 16) | |
247 | ||
248 | /* RM: for return command */ | |
ebba8386 AC |
249 | #undef DEPRECATED_STORE_RETURN_VALUE |
250 | #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
adf40b2e | 251 | { \ |
77296879 | 252 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ |
73937e03 | 253 | deprecated_write_register_bytes \ |
adf40b2e | 254 | (REGISTER_BYTE (FP4_REGNUM) + \ |
b1e29e33 | 255 | (DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ |
adf40b2e JM |
256 | (VALBUF), \ |
257 | TYPE_LENGTH (TYPE)); \ | |
77296879 | 258 | else if (is_integral_type(TYPE)) \ |
73937e03 | 259 | deprecated_write_register_bytes \ |
adf40b2e | 260 | (REGISTER_BYTE (28) + \ |
b1e29e33 | 261 | (DEPRECATED_REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ |
adf40b2e JM |
262 | (VALBUF), \ |
263 | TYPE_LENGTH (TYPE)); \ | |
264 | else if (TYPE_LENGTH (TYPE) <= 8) \ | |
73937e03 | 265 | deprecated_write_register_bytes \ |
adf40b2e JM |
266 | ( REGISTER_BYTE (28), \ |
267 | (VALBUF), \ | |
268 | TYPE_LENGTH (TYPE)); \ | |
269 | else if (TYPE_LENGTH (TYPE) <= 16) \ | |
270 | { \ | |
73937e03 | 271 | deprecated_write_register_bytes \ |
adf40b2e JM |
272 | (REGISTER_BYTE (28), \ |
273 | (VALBUF), \ | |
274 | 8); \ | |
73937e03 | 275 | deprecated_write_register_bytes \ |
adf40b2e JM |
276 | (REGISTER_BYTE (29), \ |
277 | ((char *) VALBUF + 8), \ | |
278 | TYPE_LENGTH (TYPE) - 8); \ | |
279 | } \ | |
280 | } | |
281 | ||
282 | /* RM: these are the PA64 equivalents of the macros in tm-hppah.h -- | |
283 | * see comments there. For PA64, the save_state structure is at an | |
284 | * offset of 24 32-bit words from the sigcontext structure. The 64 bit | |
285 | * general registers are at an offset of 640 bytes from the beginning of the | |
286 | * save_state structure, and the floating pointer register are at an offset | |
287 | * of 256 bytes from the beginning of the save_state structure. | |
288 | */ | |
289 | #undef FRAME_SAVED_PC_IN_SIGTRAMP | |
290 | #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \ | |
291 | { \ | |
aef9bcd2 | 292 | *(TMP) = read_memory_integer (get_frame_base (FRAME) + (24 * 4) + 640 + (33 * 8), 8); \ |
adf40b2e JM |
293 | } |
294 | ||
295 | #undef FRAME_BASE_BEFORE_SIGTRAMP | |
296 | #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ | |
297 | { \ | |
aef9bcd2 | 298 | *(TMP) = read_memory_integer (get_frame_base (FRAME) + (24 * 4) + 640 + (30 * 8), 8); \ |
adf40b2e JM |
299 | } |
300 | ||
301 | #undef FRAME_FIND_SAVED_REGS_IN_SIGTRAMP | |
302 | #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ | |
303 | { \ | |
304 | int i; \ | |
305 | CORE_ADDR TMP1, TMP2; \ | |
aef9bcd2 AC |
306 | TMP1 = get_frame_base (FRAME) + (24 * 4) + 640; \ |
307 | TMP2 = get_frame_base (FRAME) + (24 * 4) + 256; \ | |
adf40b2e JM |
308 | for (i = 0; i < NUM_REGS; i++) \ |
309 | { \ | |
310 | if (i == SP_REGNUM) \ | |
43bd9a9e | 311 | (FSR)[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ |
adf40b2e | 312 | else if (i >= FP0_REGNUM) \ |
43bd9a9e | 313 | (FSR)[i] = TMP2 + (i - FP0_REGNUM) * 8; \ |
adf40b2e | 314 | else \ |
43bd9a9e | 315 | (FSR)[i] = TMP1 + i * 8; \ |
adf40b2e JM |
316 | } \ |
317 | } | |
318 | ||
319 | /* jimb: omitted purify call support */ |