]>
Commit | Line | Data |
---|---|---|
d83a6710 SG |
1 | /* Parameters for execution on any Hewlett-Packard PA-RISC machine. |
2 | Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 | |
3 | Free Software Foundation, Inc. | |
4 | ||
5 | Contributed by the Center for Software Science at the | |
6 | University of Utah ([email protected]). | |
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., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
23 | ||
24 | /* Target system byte order. */ | |
25 | ||
26 | #define TARGET_BYTE_ORDER BIG_ENDIAN | |
27 | ||
28 | /* Get at various relevent fields of an instruction word. */ | |
29 | ||
30 | #define MASK_5 0x1f | |
31 | #define MASK_11 0x7ff | |
32 | #define MASK_14 0x3fff | |
33 | #define MASK_21 0x1fffff | |
34 | ||
35 | /* This macro gets bit fields using HP's numbering (MSB = 0) */ | |
36 | ||
37 | #define GET_FIELD(X, FROM, TO) \ | |
38 | ((X) >> 31 - (TO) & (1 << ((TO) - (FROM) + 1)) - 1) | |
39 | ||
40 | /* Watch out for NaNs */ | |
41 | ||
42 | #define IEEE_FLOAT | |
43 | ||
50355472 JL |
44 | /* On the PA, any pass-by-value structure > 8 bytes is actually |
45 | passed via a pointer regardless of its type or the compiler | |
46 | used. */ | |
d83a6710 | 47 | |
50355472 JL |
48 | #define REG_STRUCT_HAS_ADDR(gcc_p,type) \ |
49 | (TYPE_LENGTH (type) > 8) | |
d83a6710 SG |
50 | |
51 | /* Offset from address of function to start of its code. | |
52 | Zero on most machines. */ | |
53 | ||
54 | #define FUNCTION_START_OFFSET 0 | |
55 | ||
56 | /* Advance PC across any function entry prologue instructions | |
57 | to reach some "real" code. */ | |
58 | ||
d83a6710 SG |
59 | #define SKIP_PROLOGUE(pc) pc = skip_prologue (pc) |
60 | ||
61 | /* If PC is in some function-call trampoline code, return the PC | |
62 | where the function itself actually starts. If not, return NULL. */ | |
63 | ||
64 | #define SKIP_TRAMPOLINE_CODE(pc) skip_trampoline_code (pc, NULL) | |
65 | ||
481faa25 JL |
66 | /* Return non-zero if we are in an appropriate trampoline. */ |
67 | ||
68 | #define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ | |
69 | in_solib_call_trampoline (pc, name) | |
70 | ||
71 | #define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \ | |
72 | in_solib_return_trampoline (pc, name) | |
73 | ||
74 | /* For some stupid reason find_pc_partial_function wants to treat | |
75 | trampoline symbols differently. | |
76 | ||
77 | In a nutshell, find_pc_partial_fucntion sets the low address for | |
78 | the function to the PC value that was passed in if the PC value | |
79 | passed in is a mst_trampoline symbol. | |
d83a6710 | 80 | |
481faa25 JL |
81 | This causes wait_for_inferior to execute code for stepping over |
82 | or around a function (stop_pc == stop_func_start). This is | |
83 | extremely bad when we're stepping through a return from a shared | |
84 | library back to user code (which on the PA uses trampolines). */ | |
85 | #define INHIBIT_SUNSOLIB_TRANSFER_TABLE_HACK | |
d83a6710 SG |
86 | |
87 | /* Immediately after a function call, return the saved pc. | |
88 | Can't go through the frames for this because on some machines | |
89 | the new frame is not set up until the new function executes | |
90 | some instructions. */ | |
91 | ||
d3862cae JK |
92 | #undef SAVED_PC_AFTER_CALL |
93 | #define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call (frame) | |
d83a6710 SG |
94 | |
95 | /* Stack grows upward */ | |
96 | ||
97 | #define INNER_THAN > | |
98 | ||
d83a6710 SG |
99 | /* Sequence of bytes for breakpoint instruction. */ |
100 | ||
d83a6710 | 101 | #define BREAKPOINT {0x00, 0x01, 0x00, 0x04} |
d83a6710 SG |
102 | |
103 | /* Amount PC must be decremented by after a breakpoint. | |
104 | This is often the number of bytes in BREAKPOINT | |
105 | but not always. | |
106 | ||
107 | Not on the PA-RISC */ | |
108 | ||
109 | #define DECR_PC_AFTER_BREAK 0 | |
110 | ||
111 | /* return instruction is bv r0(rp) or bv,n r0(rp)*/ | |
112 | ||
113 | #define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 4) | 0x2) == 0xE840C002) | |
114 | ||
f4f0d174 JK |
115 | /* Say how long (ordinary) registers are. This is a piece of bogosity |
116 | used in push_word and a few other places; REGISTER_RAW_SIZE is the | |
117 | real way to know how big a register is. */ | |
d83a6710 | 118 | |
f4f0d174 | 119 | #define REGISTER_SIZE 4 |
d83a6710 SG |
120 | |
121 | /* Number of machine registers */ | |
122 | ||
50355472 | 123 | #define NUM_REGS 128 |
d83a6710 SG |
124 | |
125 | /* Initializer for an array of names of registers. | |
126 | There should be NUM_REGS strings in this initializer. */ | |
127 | ||
128 | #define REGISTER_NAMES \ | |
129 | {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \ | |
130 | "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \ | |
481faa25 | 131 | "r20", "r21", "r22", "r23", "r24", "r25", "r26", "dp", "ret0", "ret1", \ |
d83a6710 SG |
132 | "sp", "r31", "sar", "pcoqh", "pcsqh", "pcoqt", "pcsqt", \ |
133 | "eiem", "iir", "isr", "ior", "ipsw", "goto", "sr4", "sr0", "sr1", "sr2", \ | |
134 | "sr3", "sr5", "sr6", "sr7", "cr0", "cr8", "cr9", "ccr", "cr12", "cr13", \ | |
135 | "cr24", "cr25", "cr26", "mpsfu_high", "mpsfu_low", "mpsfu_ovflo", "pad", \ | |
136 | "fpsr", "fpe1", "fpe2", "fpe3", "fpe4", "fpe5", "fpe6", "fpe7", \ | |
50355472 JL |
137 | "fr4", "fr4R", "fr5", "fr5R", "fr6", "fr6R", "fr7", "fr7R", \ |
138 | "fr8", "fr8R", "fr9", "fr9R", "fr10", "fr10R", "fr11", "fr11R", \ | |
139 | "fr12", "fr12R", "fr13", "fr13R", "fr14", "fr14R", "fr15", "fr15R", \ | |
140 | "fr16", "fr16R", "fr17", "fr17R", "fr18", "fr18R", "fr19", "fr19R", \ | |
141 | "fr20", "fr20R", "fr21", "fr21R", "fr22", "fr22R", "fr23", "fr23R", \ | |
142 | "fr24", "fr24R", "fr25", "fr25R", "fr26", "fr26R", "fr27", "fr27R", \ | |
143 | "fr28", "fr28R", "fr29", "fr29R", "fr30", "fr30R", "fr31", "fr31R"} | |
d83a6710 SG |
144 | |
145 | /* Register numbers of various important registers. | |
146 | Note that some of these values are "real" register numbers, | |
147 | and correspond to the general registers of the machine, | |
148 | and some are "phony" register numbers which are too large | |
149 | to be actual register numbers as far as the user is concerned | |
150 | but do serve to get the desired values when passed to read_register. */ | |
151 | ||
7486c68d SG |
152 | #define R0_REGNUM 0 /* Doesn't actually exist, used as base for |
153 | other r registers. */ | |
d83a6710 SG |
154 | #define FLAGS_REGNUM 0 /* Various status flags */ |
155 | #define RP_REGNUM 2 /* return pointer */ | |
c7f3b703 | 156 | #define FP_REGNUM 3 /* Contains address of executing stack */ |
d83a6710 SG |
157 | /* frame */ |
158 | #define SP_REGNUM 30 /* Contains address of top of stack */ | |
7486c68d SG |
159 | #define SAR_REGNUM 32 /* Shift Amount Register */ |
160 | #define IPSW_REGNUM 41 /* Interrupt Processor Status Word */ | |
d83a6710 SG |
161 | #define PCOQ_HEAD_REGNUM 33 /* instruction offset queue head */ |
162 | #define PCSQ_HEAD_REGNUM 34 /* instruction space queue head */ | |
163 | #define PCOQ_TAIL_REGNUM 35 /* instruction offset queue tail */ | |
164 | #define PCSQ_TAIL_REGNUM 36 /* instruction space queue tail */ | |
7486c68d SG |
165 | #define EIEM_REGNUM 37 /* External Interrupt Enable Mask */ |
166 | #define IIR_REGNUM 38 /* Interrupt Instruction Register */ | |
167 | #define IOR_REGNUM 40 /* Interrupt Offset Register */ | |
168 | #define SR4_REGNUM 43 /* space register 4 */ | |
169 | #define RCR_REGNUM 51 /* Recover Counter (also known as cr0) */ | |
170 | #define CCR_REGNUM 54 /* Coprocessor Configuration Register */ | |
171 | #define TR0_REGNUM 57 /* Temporary Registers (cr24 -> cr31) */ | |
d83a6710 SG |
172 | #define FP0_REGNUM 64 /* floating point reg. 0 */ |
173 | #define FP4_REGNUM 72 | |
174 | ||
175 | /* compatibility with the rest of gdb. */ | |
176 | #define PC_REGNUM PCOQ_HEAD_REGNUM | |
177 | #define NPC_REGNUM PCOQ_TAIL_REGNUM | |
178 | ||
179 | /* When fetching register values from an inferior or a core file, | |
180 | clean them up using this macro. BUF is a char pointer to | |
181 | the raw value of the register in the registers[] array. */ | |
182 | ||
183 | #define CLEAN_UP_REGISTER_VALUE(regno, buf) \ | |
184 | do { \ | |
185 | if ((regno) == PCOQ_HEAD_REGNUM || (regno) == PCOQ_TAIL_REGNUM) \ | |
186 | (buf)[3] &= ~0x3; \ | |
187 | } while (0) | |
188 | ||
189 | /* Define DO_REGISTERS_INFO() to do machine-specific formatting | |
190 | of register dumps. */ | |
191 | ||
192 | #define DO_REGISTERS_INFO(_regnum, fp) pa_do_registers_info (_regnum, fp) | |
193 | ||
194 | /* PA specific macro to see if the current instruction is nullified. */ | |
195 | #define INSTRUCTION_NULLIFIED ((int)read_register (IPSW_REGNUM) & 0x00200000) | |
196 | ||
50355472 JL |
197 | /* Number of bytes of storage in the actual machine representation |
198 | for register N. On the PA-RISC, all regs are 4 bytes, including | |
199 | the FP registers (they're accessed as two 4 byte halves). */ | |
200 | ||
201 | #define REGISTER_RAW_SIZE(N) 4 | |
202 | ||
d83a6710 SG |
203 | /* Total amount of space needed to store our copies of the machine's |
204 | register state, the array `registers'. */ | |
481faa25 | 205 | #define REGISTER_BYTES (NUM_REGS * 4) |
d83a6710 SG |
206 | |
207 | /* Index within `registers' of the first byte of the space for | |
208 | register N. */ | |
209 | ||
50355472 | 210 | #define REGISTER_BYTE(N) (N) * 4 |
d83a6710 SG |
211 | |
212 | /* Number of bytes of storage in the program's representation | |
213 | for register N. */ | |
214 | ||
215 | #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) | |
216 | ||
217 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
218 | ||
50355472 | 219 | #define MAX_REGISTER_RAW_SIZE 4 |
d83a6710 SG |
220 | |
221 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
222 | ||
223 | #define MAX_REGISTER_VIRTUAL_SIZE 8 | |
224 | ||
d83a6710 SG |
225 | /* Return the GDB type object for the "standard" data type |
226 | of data in register N. */ | |
227 | ||
228 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
50355472 | 229 | ((N) < FP4_REGNUM ? builtin_type_int : builtin_type_float) |
d83a6710 SG |
230 | |
231 | /* Store the address of the place in which to copy the structure the | |
232 | subroutine will return. This is called from call_function. */ | |
233 | ||
234 | #define STORE_STRUCT_RETURN(ADDR, SP) {write_register (28, (ADDR)); } | |
235 | ||
236 | /* Extract from an array REGBUF containing the (raw) register state | |
237 | a function return value of type TYPE, and copy that, in virtual format, | |
238 | into VALBUF. */ | |
239 | ||
240 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
61fe99b4 JL |
241 | { \ |
242 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ | |
243 | memcpy ((VALBUF), \ | |
244 | ((int *)(REGBUF)) + REGISTER_BYTE (FP4_REGNUM), \ | |
245 | TYPE_LENGTH (TYPE)); \ | |
246 | else \ | |
247 | memcpy ((VALBUF), \ | |
248 | (char *)(REGBUF) + REGISTER_BYTE (28) + \ | |
249 | (TYPE_LENGTH (TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH (TYPE)), \ | |
250 | TYPE_LENGTH (TYPE)); \ | |
251 | } | |
d83a6710 SG |
252 | |
253 | /* Write into appropriate registers a function return value | |
254 | of type TYPE, given in virtual format. */ | |
255 | ||
256 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
f4f0d174 JK |
257 | write_register_bytes ((TYPE_LENGTH(TYPE) > 4 \ |
258 | ? REGISTER_BYTE (FP4_REGNUM) \ | |
259 | : REGISTER_BYTE (28)), \ | |
260 | (VALBUF), TYPE_LENGTH (TYPE)) | |
d83a6710 SG |
261 | |
262 | /* Extract from an array REGBUF containing the (raw) register state | |
263 | the address in which a function should return its structure value, | |
264 | as a CORE_ADDR (or an expression that can be used as one). */ | |
265 | ||
266 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)((REGBUF) + 28)) | |
267 | ||
268 | /* | |
269 | * This macro defines the register numbers (from REGISTER_NAMES) that | |
270 | * are effectively unavailable to the user through ptrace(). It allows | |
271 | * us to include the whole register set in REGISTER_NAMES (inorder to | |
272 | * better support remote debugging). If it is used in | |
273 | * fetch/store_inferior_registers() gdb will not complain about I/O errors | |
274 | * on fetching these registers. If all registers in REGISTER_NAMES | |
275 | * are available, then return false (0). | |
276 | */ | |
277 | ||
278 | #define CANNOT_STORE_REGISTER(regno) \ | |
279 | ((regno) == 0) || \ | |
280 | ((regno) == PCSQ_HEAD_REGNUM) || \ | |
281 | ((regno) >= PCSQ_TAIL_REGNUM && (regno) < IPSW_REGNUM) || \ | |
282 | ((regno) > IPSW_REGNUM && (regno) < FP4_REGNUM) | |
283 | ||
284 | #define INIT_EXTRA_FRAME_INFO(fromleaf, frame) init_extra_frame_info (fromleaf, frame) | |
285 | ||
286 | /* Describe the pointer in each stack frame to the previous stack frame | |
287 | (its caller). */ | |
288 | ||
289 | /* FRAME_CHAIN takes a frame's nominal address | |
290 | and produces the frame's chain-pointer. | |
291 | ||
292 | FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address | |
293 | and produces the nominal address of the caller frame. | |
294 | ||
295 | However, if FRAME_CHAIN_VALID returns zero, | |
296 | it means the given frame is the outermost one and has no caller. | |
297 | In that case, FRAME_CHAIN_COMBINE is not used. */ | |
298 | ||
299 | /* In the case of the PA-RISC, the frame's nominal address | |
300 | is the address of a 4-byte word containing the calling frame's | |
301 | address (previous FP). */ | |
302 | ||
303 | #define FRAME_CHAIN(thisframe) frame_chain (thisframe) | |
304 | ||
305 | #define FRAME_CHAIN_VALID(chain, thisframe) \ | |
306 | frame_chain_valid (chain, thisframe) | |
307 | ||
308 | #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) | |
309 | ||
310 | /* Define other aspects of the stack frame. */ | |
311 | ||
312 | /* A macro that tells us whether the function invocation represented | |
313 | by FI does not have a frame on the stack associated with it. If it | |
314 | does not, FRAMELESS is set to 1, else 0. */ | |
315 | #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ | |
d3862cae | 316 | (FRAMELESS) = frameless_function_invocation(FI) |
d83a6710 SG |
317 | |
318 | #define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME) | |
319 | ||
320 | #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) | |
321 | ||
322 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
323 | /* Set VAL to the number of args passed to frame described by FI. | |
324 | Can set VAL to -1, meaning no way to tell. */ | |
325 | ||
326 | /* We can't tell how many args there are | |
327 | now that the C compiler delays popping them. */ | |
328 | #define FRAME_NUM_ARGS(val,fi) (val = -1) | |
329 | ||
330 | /* Return number of bytes at start of arglist that are not really args. */ | |
331 | ||
332 | #define FRAME_ARGS_SKIP 0 | |
333 | ||
c7f3b703 JL |
334 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ |
335 | hppa_frame_find_saved_regs (frame_info, &frame_saved_regs) | |
336 | ||
d83a6710 SG |
337 | \f |
338 | /* Things needed for making the inferior call functions. */ | |
339 | ||
340 | /* Push an empty stack frame, to record the current PC, etc. */ | |
341 | ||
7486c68d | 342 | #define PUSH_DUMMY_FRAME push_dummy_frame (&inf_status) |
d83a6710 SG |
343 | |
344 | /* Discard from the stack the innermost frame, | |
345 | restoring all saved registers. */ | |
346 | #define POP_FRAME hppa_pop_frame () | |
347 | ||
7486c68d SG |
348 | #define INSTRUCTION_SIZE 4 |
349 | ||
350 | #ifndef PA_LEVEL_0 | |
351 | ||
352 | /* Non-level zero PA's have space registers (but they don't always have | |
353 | floating-point, do they???? */ | |
354 | ||
d83a6710 SG |
355 | /* This sequence of words is the instructions |
356 | ||
357 | ; Call stack frame has already been built by gdb. Since we could be calling | |
358 | ; a varargs function, and we do not have the benefit of a stub to put things in | |
359 | ; the right place, we load the first 4 word of arguments into both the general | |
360 | ; and fp registers. | |
361 | call_dummy | |
362 | ldw -36(sp), arg0 | |
363 | ldw -40(sp), arg1 | |
364 | ldw -44(sp), arg2 | |
365 | ldw -48(sp), arg3 | |
366 | ldo -36(sp), r1 | |
367 | fldws 0(0, r1), fr4 | |
368 | fldds -4(0, r1), fr5 | |
369 | fldws -8(0, r1), fr6 | |
370 | fldds -12(0, r1), fr7 | |
7486c68d SG |
371 | ldil 0, r22 ; FUNC_LDIL_OFFSET must point here |
372 | ldo 0(r22), r22 ; FUNC_LDO_OFFSET must point here | |
c7f3b703 | 373 | ldsid (0,r22), r4 |
7486c68d SG |
374 | ldil 0, r1 ; SR4EXPORT_LDIL_OFFSET must point here |
375 | ldo 0(r1), r1 ; SR4EXPORT_LDO_OFFSET must point here | |
4f915914 | 376 | ldsid (0,r1), r20 |
853feb50 | 377 | combt,=,n r4, r20, text_space ; If target is in data space, do a |
d83a6710 SG |
378 | ble 0(sr5, r22) ; "normal" procedure call |
379 | copy r31, r2 | |
380 | break 4, 8 | |
381 | mtsp r21, sr0 | |
382 | ble,n 0(sr0, r22) | |
383 | text_space ; Otherwise, go through _sr4export, | |
384 | ble (sr4, r1) ; which will return back here. | |
385 | stw 31,-24(r30) | |
386 | break 4, 8 | |
387 | mtsp r21, sr0 | |
388 | ble,n 0(sr0, r22) | |
50355472 JL |
389 | nop ; To avoid kernel bugs |
390 | nop ; and keep the dummy 8 byte aligned | |
d83a6710 SG |
391 | |
392 | The dummy decides if the target is in text space or data space. If | |
393 | it's in data space, there's no problem because the target can | |
394 | return back to the dummy. However, if the target is in text space, | |
395 | the dummy calls the secret, undocumented routine _sr4export, which | |
396 | calls a function in text space and can return to any space. Instead | |
397 | of including fake instructions to represent saved registers, we | |
398 | know that the frame is associated with the call dummy and treat it | |
50355472 JL |
399 | specially. |
400 | ||
401 | The trailing NOPs are needed to avoid a bug in HPUX, BSD and OSF1 | |
402 | kernels. If the memory at the location pointed to by the PC is | |
403 | 0xffffffff then a ptrace step call will fail (even if the instruction | |
404 | is nullified). | |
405 | ||
406 | The code to pop a dummy frame single steps three instructions | |
407 | starting with the last mtsp. This includes the nullified "instruction" | |
408 | following the ble (which is uninitialized junk). If the | |
409 | "instruction" following the last BLE is 0xffffffff, then the ptrace | |
410 | will fail and the dummy frame is not correctly popped. | |
411 | ||
412 | By placing a NOP in the delay slot of the BLE instruction we can be | |
413 | sure that we never try to execute a 0xffffffff instruction and | |
414 | avoid the kernel bug. The second NOP is needed to keep the call | |
415 | dummy 8 byte aligned. */ | |
d83a6710 | 416 | |
7486c68d SG |
417 | /* Define offsets into the call dummy for the target function address */ |
418 | #define FUNC_LDIL_OFFSET (INSTRUCTION_SIZE * 9) | |
419 | #define FUNC_LDO_OFFSET (INSTRUCTION_SIZE * 10) | |
420 | ||
421 | /* Define offsets into the call dummy for the _sr4export address */ | |
422 | #define SR4EXPORT_LDIL_OFFSET (INSTRUCTION_SIZE * 12) | |
423 | #define SR4EXPORT_LDO_OFFSET (INSTRUCTION_SIZE * 13) | |
424 | ||
d83a6710 SG |
425 | #define CALL_DUMMY {0x4BDA3FB9, 0x4BD93FB1, 0x4BD83FA9, 0x4BD73FA1,\ |
426 | 0x37C13FB9, 0x24201004, 0x2C391005, 0x24311006,\ | |
c7f3b703 | 427 | 0x2C291007, 0x22C00000, 0x36D60000, 0x02C010A4,\ |
853feb50 | 428 | 0x20200000, 0x34210000, 0x002010b4, 0x82842022,\ |
d83a6710 SG |
429 | 0xe6c06000, 0x081f0242, 0x00010004, 0x00151820,\ |
430 | 0xe6c00002, 0xe4202000, 0x6bdf3fd1, 0x00010004,\ | |
50355472 | 431 | 0x00151820, 0xe6c00002, 0x08000240, 0x08000240} |
d83a6710 | 432 | |
7486c68d SG |
433 | #define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 28) |
434 | ||
435 | #else /* defined PA_LEVEL_0 */ | |
436 | ||
437 | /* This is the call dummy for a level 0 PA. Level 0's don't have space | |
438 | registers (or floating point??), so we skip all that inter-space call stuff, | |
439 | and avoid touching the fp regs. | |
440 | ||
441 | call_dummy | |
442 | ||
443 | ldw -36(%sp), %arg0 | |
444 | ldw -40(%sp), %arg1 | |
445 | ldw -44(%sp), %arg2 | |
446 | ldw -48(%sp), %arg3 | |
447 | ldil 0, %r31 ; FUNC_LDIL_OFFSET must point here | |
448 | ldo 0(%r31), %r31 ; FUNC_LDO_OFFSET must point here | |
449 | ble 0(0,%r31) | |
450 | copy %r31, %r2 | |
451 | break 4, 8 | |
452 | */ | |
453 | ||
454 | /* Define offsets into the call dummy for the target function address */ | |
455 | #define FUNC_LDIL_OFFSET (INSTRUCTION_SIZE * 4) | |
456 | #define FUNC_LDO_OFFSET (INSTRUCTION_SIZE * 5) | |
457 | ||
458 | #define CALL_DUMMY {0x4bda3fb9, 0x4bd93fb1, 0x4bd83fa9, 0x4bd73fa1,\ | |
459 | 0x23e00000, 0x37ff0000, 0xe7e00000, 0x081f0242,\ | |
460 | 0x00010004} | |
461 | ||
462 | #define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 9) | |
463 | ||
464 | #endif | |
465 | ||
d83a6710 SG |
466 | #define CALL_DUMMY_START_OFFSET 0 |
467 | ||
468 | /* | |
469 | * Insert the specified number of args and function address | |
470 | * into a call sequence of the above form stored at DUMMYNAME. | |
471 | * | |
472 | * On the hppa we need to call the stack dummy through $$dyncall. | |
473 | * Therefore our version of FIX_CALL_DUMMY takes an extra argument, | |
474 | * real_pc, which is the location where gdb should start up the | |
475 | * inferior to do the function call. | |
476 | */ | |
477 | ||
478 | #define FIX_CALL_DUMMY hppa_fix_call_dummy | |
479 | ||
480 | CORE_ADDR hppa_fix_call_dummy(); | |
481 | ||
482 | #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ | |
483 | sp = hppa_push_arguments(nargs, args, sp, struct_return, struct_addr) | |
9fdb3f7a JK |
484 | \f |
485 | /* The low two bits of the PC on the PA contain the privilege level. Some | |
486 | genius implementing a (non-GCC) compiler apparently decided this means | |
487 | that "addresses" in a text section therefore include a privilege level, | |
488 | and thus symbol tables should contain these bits. This seems like a | |
489 | bonehead thing to do--anyway, it seems to work for our purposes to just | |
490 | ignore those bits. */ | |
491 | #define SMASH_TEXT_ADDRESS(addr) ((addr) &= ~0x3) | |
d83a6710 SG |
492 | |
493 | #define GDB_TARGET_IS_HPPA | |
494 | ||
495 | #define BELIEVE_PCC_PROMOTION 1 | |
496 | ||
497 | /* | |
498 | * Unwind table and descriptor. | |
499 | */ | |
500 | ||
501 | struct unwind_table_entry { | |
502 | unsigned int region_start; | |
503 | unsigned int region_end; | |
504 | ||
505 | unsigned int Cannot_unwind : 1; | |
506 | unsigned int Millicode : 1; | |
507 | unsigned int Millicode_save_sr0 : 1; | |
508 | unsigned int Region_description : 2; | |
c7f3b703 | 509 | unsigned int reserved1 : 1; |
d83a6710 SG |
510 | unsigned int Entry_SR : 1; |
511 | unsigned int Entry_FR : 4; /* number saved */ | |
512 | unsigned int Entry_GR : 5; /* number saved */ | |
513 | unsigned int Args_stored : 1; | |
514 | unsigned int Variable_Frame : 1; | |
515 | unsigned int Separate_Package_Body : 1; | |
516 | unsigned int Frame_Extension_Millicode:1; | |
517 | unsigned int Stack_Overflow_Check : 1; | |
518 | unsigned int Two_Instruction_SP_Increment:1; | |
519 | unsigned int Ada_Region : 1; | |
c7f3b703 JL |
520 | /* Use this field to store a stub unwind type. */ |
521 | #define stub_type reserved2 | |
d83a6710 SG |
522 | unsigned int reserved2 : 4; |
523 | unsigned int Save_SP : 1; | |
524 | unsigned int Save_RP : 1; | |
525 | unsigned int Save_MRP_in_frame : 1; | |
526 | unsigned int extn_ptr_defined : 1; | |
527 | unsigned int Cleanup_defined : 1; | |
528 | ||
529 | unsigned int MPE_XL_interrupt_marker: 1; | |
530 | unsigned int HP_UX_interrupt_marker: 1; | |
531 | unsigned int Large_frame : 1; | |
532 | unsigned int reserved4 : 2; | |
533 | unsigned int Total_frame_size : 27; | |
534 | }; | |
535 | ||
c7f3b703 JL |
536 | /* HP linkers also generate unwinds for various linker-generated stubs. |
537 | GDB reads in the stubs from the $UNWIND_END$ subspace, then | |
538 | "converts" them into normal unwind entries using some of the reserved | |
539 | fields to store the stub type. */ | |
540 | ||
541 | struct stub_unwind_entry | |
542 | { | |
543 | /* The offset within the executable for the associated stub. */ | |
544 | unsigned stub_offset; | |
545 | ||
546 | /* The type of stub this unwind entry describes. */ | |
547 | char type; | |
548 | ||
549 | /* Unknown. Not needed by GDB at this time. */ | |
550 | char prs_info; | |
551 | ||
552 | /* Length (in instructions) of the associated stub. */ | |
553 | short stub_length; | |
554 | }; | |
555 | ||
556 | /* Sizes (in bytes) of the native unwind entries. */ | |
557 | #define UNWIND_ENTRY_SIZE 16 | |
558 | #define STUB_UNWIND_ENTRY_SIZE 8 | |
559 | ||
560 | /* The gaps represent linker stubs used in MPE and space for future | |
561 | expansion. */ | |
562 | enum unwind_stub_types | |
563 | { | |
564 | LONG_BRANCH = 1, | |
565 | PARAMETER_RELOCATION = 2, | |
566 | EXPORT = 10, | |
567 | IMPORT = 11, | |
568 | }; | |
569 | ||
570 | ||
d83a6710 SG |
571 | /* Info about the unwind table associated with an object file. This is hung |
572 | off of the objfile->obj_private pointer, and is allocated in the objfile's | |
573 | psymbol obstack. This allows us to have unique unwind info for each | |
574 | executable and shared library that we are debugging. */ | |
575 | ||
576 | struct obj_unwind_info { | |
577 | struct unwind_table_entry *table; /* Pointer to unwind info */ | |
578 | struct unwind_table_entry *cache; /* Pointer to last entry we found */ | |
579 | int last; /* Index of last entry */ | |
580 | }; | |
581 | ||
582 | #define OBJ_UNWIND_INFO(obj) ((struct obj_unwind_info *)obj->obj_private) | |
d3862cae | 583 | |
481faa25 JL |
584 | extern CORE_ADDR target_read_pc PARAMS ((int)); |
585 | extern void target_write_pc PARAMS ((CORE_ADDR, int)); | |
7486c68d | 586 | extern CORE_ADDR skip_trampoline_code PARAMS ((CORE_ADDR, char *)); |
481faa25 JL |
587 | |
588 | #define TARGET_READ_PC(pid) target_read_pc (pid) | |
589 | #define TARGET_WRITE_PC(v,pid) target_write_pc (v,pid) | |
590 | ||
481faa25 JL |
591 | /* For a number of horrible reasons we may have to adjust the location |
592 | of variables on the stack. Ugh. */ | |
593 | #define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR) | |
f4f0d174 | 594 | |
481faa25 | 595 | extern int hpread_adjust_stack_address PARAMS ((CORE_ADDR)); |