]>
Commit | Line | Data |
---|---|---|
9f739abd SG |
1 | /* Parameters for execution on a Hewlett-Packard PA-RISC machine, running |
2 | HPUX or BSD. | |
5140562f JG |
3 | Copyright 1986, 1987, 1989, 1990, 1991, 1992 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 | ||
44 | /* Groan */ | |
45 | ||
46 | #define ARGS_GROW_DOWN | |
47 | ||
48 | /* Define this if the C compiler puts an underscore at the front | |
49 | of external names before giving them to the linker. */ | |
50 | ||
51 | /* #define NAMES_HAVE_UNDERSCORE */ | |
52 | ||
53 | /* Offset from address of function to start of its code. | |
54 | Zero on most machines. */ | |
55 | ||
56 | #define FUNCTION_START_OFFSET 0 | |
57 | ||
58 | /* Advance PC across any function entry prologue instructions | |
59 | to reach some "real" code. */ | |
60 | ||
61 | /* skip (stw rp, -20(0,sp)); copy 4,1; copy sp, 4; stwm 1,framesize(sp) | |
62 | for gcc, or (stw rp, -20(0,sp); stwm 1, framesize(sp) for hcc */ | |
63 | ||
64 | #define SKIP_PROLOGUE(pc) \ | |
65 | { if (read_memory_integer ((pc), 4) == 0x6BC23FD9) \ | |
66 | { if (read_memory_integer ((pc) + 4, 4) == 0x8040241) \ | |
67 | (pc) += 16; \ | |
68 | else if ((read_memory_integer (pc + 4, 4) & ~MASK_14) == 0x68810000) \ | |
69 | (pc) += 8;} \ | |
70 | else if (read_memory_integer ((pc), 4) == 0x8040241) \ | |
71 | (pc) += 12; \ | |
72 | else if ((read_memory_integer (pc, 4) & ~MASK_14) == 0x68810000) \ | |
73 | (pc) += 4;} | |
74 | ||
9f739abd SG |
75 | /* If PC is in some function-call trampoline code, return the PC |
76 | where the function itself actually starts. If not, return NULL. */ | |
77 | ||
78 | #define SKIP_TRAMPOLINE_CODE(pc) skip_trampoline_code (pc) | |
79 | ||
80 | /* Return non-zero if we are in some sort of a trampoline. */ | |
81 | ||
82 | #define IN_SOLIB_TRAMPOLINE(pc,name) skip_trampoline_code (pc) | |
83 | ||
5140562f JG |
84 | /* Immediately after a function call, return the saved pc. |
85 | Can't go through the frames for this because on some machines | |
86 | the new frame is not set up until the new function executes | |
87 | some instructions. */ | |
88 | ||
89 | #define SAVED_PC_AFTER_CALL(frame) (read_register (RP_REGNUM) & ~3) | |
90 | ||
91 | /* Address of end of stack space. Who knows. */ | |
92 | ||
93 | #define STACK_END_ADDR 0x80000000 | |
94 | ||
95 | /* Stack grows upward */ | |
96 | ||
97 | #define INNER_THAN > | |
98 | ||
99 | ||
100 | /* Sequence of bytes for breakpoint instruction. */ | |
101 | ||
102 | /*#define BREAKPOINT {0x00, 0x00, 0x00, 0x00}*/ | |
103 | #ifdef KERNELDEBUG /* XXX */ | |
104 | #define BREAKPOINT {0x00, 0x00, 0xa0, 0x00} | |
105 | #else | |
106 | #define BREAKPOINT {0x00, 0x01, 0x00, 0x04} | |
107 | #endif | |
108 | ||
109 | /* Amount PC must be decremented by after a breakpoint. | |
110 | This is often the number of bytes in BREAKPOINT | |
111 | but not always. | |
112 | ||
113 | Not on the PA-RISC */ | |
114 | ||
115 | #define DECR_PC_AFTER_BREAK 0 | |
116 | ||
117 | /* return instruction is bv r0(rp) */ | |
118 | ||
119 | #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 4) == 0xE840C000) | |
120 | ||
121 | /* Return 1 if P points to an invalid floating point value. */ | |
122 | ||
123 | #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ | |
124 | ||
125 | /* Largest integer type */ | |
126 | #define LONGEST long | |
127 | ||
128 | /* Name of the builtin type for the LONGEST type above. */ | |
129 | #define BUILTIN_TYPE_LONGEST builtin_type_long | |
130 | ||
131 | /* Say how long (ordinary) registers are. */ | |
132 | ||
133 | #define REGISTER_TYPE long | |
134 | ||
135 | /* Number of machine registers */ | |
136 | ||
137 | #define NUM_REGS 100 | |
138 | ||
139 | /* Initializer for an array of names of registers. | |
140 | There should be NUM_REGS strings in this initializer. */ | |
141 | ||
142 | #define REGISTER_NAMES \ | |
143 | {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \ | |
144 | "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \ | |
145 | "r20", "r21", "r22", "arg3", "arg2", "arg1", "arg0", "dp", "ret0", "ret1", \ | |
146 | "sp", "r31", "sar", "pcoqh", "pcsqh", "pcoqt", "pcsqt", \ | |
147 | "eiem", "iir", "isr", "ior", "ipsw", "goto", "sr4", "sr0", "sr1", "sr2", \ | |
148 | "sr3", "sr5", "sr6", "sr7", "cr0", "cr8", "cr9", "ccr", "cr12", "cr13", \ | |
149 | "cr24", "cr25", "cr26", "mpsfu_high", "mpsfu_low", "mpsfu_ovflo", "pad", \ | |
150 | "fpsr", "fpe1", "fpe2", "fpe3", "fpe4", "fpe5", "fpe6", "fpe7", \ | |
151 | "fp4", "fp5", "fp6", "fp7", "fp8", \ | |
152 | "fp9", "fp10", "fp11", "fp12", "fp13", "fp14", "fp15", \ | |
153 | "fp16", "fp17", "fp18", "fp19", "fp20", "fp21", "fp22", "fp23", \ | |
154 | "fp24", "fp25", "fp26", "fp27", "fp28", "fp29", "fp30", "fp31"} | |
155 | ||
156 | /* Register numbers of various important registers. | |
157 | Note that some of these values are "real" register numbers, | |
158 | and correspond to the general registers of the machine, | |
159 | and some are "phony" register numbers which are too large | |
160 | to be actual register numbers as far as the user is concerned | |
161 | but do serve to get the desired values when passed to read_register. */ | |
162 | ||
9f739abd | 163 | #define FLAGS_REGNUM 0 /* Various status flags */ |
5140562f JG |
164 | #define RP_REGNUM 2 /* return pointer */ |
165 | #define FP_REGNUM 4 /* Contains address of executing stack */ | |
166 | /* frame */ | |
167 | #define SP_REGNUM 30 /* Contains address of top of stack */ | |
168 | #define SAR_REGNUM 32 /* shift amount register */ | |
169 | #define IPSW_REGNUM 41 /* processor status word. ? */ | |
170 | #define PCOQ_HEAD_REGNUM 33 /* instruction offset queue head */ | |
171 | #define PCSQ_HEAD_REGNUM 34 /* instruction space queue head */ | |
172 | #define PCOQ_TAIL_REGNUM 35 /* instruction offset queue tail */ | |
173 | #define PCSQ_TAIL_REGNUM 36 /* instruction space queue tail */ | |
174 | #define FP0_REGNUM 64 /* floating point reg. 0 */ | |
175 | #define FP4_REGNUM 72 | |
176 | ||
177 | /* compatibility with the rest of gdb. */ | |
178 | #define PC_REGNUM PCOQ_HEAD_REGNUM | |
179 | #define NPC_REGNUM PCOQ_TAIL_REGNUM | |
180 | ||
e0ba1d14 JG |
181 | /* When fetching register values from an inferior or a core file, |
182 | clean them up using this macro. BUF is a char pointer to | |
183 | the raw value of the register in the registers[] array. */ | |
184 | ||
185 | #define CLEAN_UP_REGISTER_VALUE(regno, buf) \ | |
186 | do { \ | |
187 | if ((regno) == PCOQ_HEAD_REGNUM || (regno) == PCOQ_TAIL_REGNUM) \ | |
188 | (buf)[3] &= ~0x3; \ | |
189 | } while (0) | |
190 | ||
5140562f JG |
191 | /* Define DO_REGISTERS_INFO() to do machine-specific formatting |
192 | of register dumps. */ | |
193 | ||
194 | #define DO_REGISTERS_INFO(_regnum, fp) pa_do_registers_info (_regnum, fp) | |
195 | ||
196 | /* PA specific macro to see if the current instruction is nullified. */ | |
197 | #define INSTRUCTION_NULLIFIED ((int)read_register (IPSW_REGNUM) & 0x00200000) | |
198 | ||
199 | /* Total amount of space needed to store our copies of the machine's | |
200 | register state, the array `registers'. */ | |
201 | #define REGISTER_BYTES (32 * 4 + 11 * 4 + 8 * 4 + 12 * 4 + 4 + 32 * 8) | |
202 | ||
203 | /* Index within `registers' of the first byte of the space for | |
204 | register N. */ | |
205 | ||
206 | #define REGISTER_BYTE(N) \ | |
207 | ((N) >= FP4_REGNUM ? ((N) - FP4_REGNUM) * 8 + 288 : (N) * 4) | |
208 | ||
209 | /* Number of bytes of storage in the actual machine representation | |
210 | for register N. On the PA-RISC, all regs are 4 bytes | |
211 | except the floating point regs which are 8 bytes. */ | |
212 | ||
213 | #define REGISTER_RAW_SIZE(N) ((N) < FP4_REGNUM ? 4 : 8) | |
214 | ||
215 | /* Number of bytes of storage in the program's representation | |
216 | for register N. */ | |
217 | ||
218 | #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) | |
219 | ||
220 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
221 | ||
222 | #define MAX_REGISTER_RAW_SIZE 8 | |
223 | ||
224 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
225 | ||
226 | #define MAX_REGISTER_VIRTUAL_SIZE 8 | |
227 | ||
228 | /* Nonzero if register N requires conversion | |
229 | from raw format to virtual format. */ | |
230 | ||
231 | #define REGISTER_CONVERTIBLE(N) 0 | |
232 | ||
233 | /* Convert data from raw format for register REGNUM | |
234 | to virtual format for register REGNUM. */ | |
235 | ||
9f739abd SG |
236 | #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM, FROM, TO) \ |
237 | { memcpy ((TO), (FROM), (REGNUM) < FP4_REGNUM ? 4 : 8); } | |
5140562f JG |
238 | |
239 | /* Convert data from virtual format for register REGNUM | |
240 | to raw format for register REGNUM. */ | |
241 | ||
9f739abd SG |
242 | #define REGISTER_CONVERT_TO_RAW(REGNUM, FROM, TO) \ |
243 | { memcpy ((TO), (FROM), (REGNUM) < FP4_REGNUM ? 4 : 8); } | |
5140562f JG |
244 | |
245 | /* Return the GDB type object for the "standard" data type | |
246 | of data in register N. */ | |
247 | ||
248 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
249 | ((N) < FP4_REGNUM ? builtin_type_int : builtin_type_double) | |
250 | ||
251 | /* Store the address of the place in which to copy the structure the | |
252 | subroutine will return. This is called from call_function. */ | |
253 | ||
254 | #define STORE_STRUCT_RETURN(ADDR, SP) {write_register (28, (ADDR)); } | |
255 | ||
256 | /* Extract from an array REGBUF containing the (raw) register state | |
257 | a function return value of type TYPE, and copy that, in virtual format, | |
258 | into VALBUF. */ | |
259 | ||
260 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
261 | bcopy ((REGBUF) + REGISTER_BYTE(TYPE_LENGTH(TYPE) > 4 ? \ | |
262 | FP4_REGNUM :28), VALBUF, TYPE_LENGTH (TYPE)) | |
263 | ||
264 | /* Write into appropriate registers a function return value | |
265 | of type TYPE, given in virtual format. */ | |
266 | ||
267 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
268 | write_register_bytes (TYPE_LENGTH(TYPE) > 4 ? FP4_REGNUM :28, \ | |
269 | VALBUF, TYPE_LENGTH (TYPE)) | |
270 | ||
271 | /* Extract from an array REGBUF containing the (raw) register state | |
272 | the address in which a function should return its structure value, | |
273 | as a CORE_ADDR (or an expression that can be used as one). */ | |
274 | ||
275 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)((REGBUF) + 28)) | |
276 | ||
9f739abd SG |
277 | /* |
278 | * This macro defines the register numbers (from REGISTER_NAMES) that | |
279 | * are effectively unavailable to the user through ptrace(). It allows | |
280 | * us to include the whole register set in REGISTER_NAMES (inorder to | |
281 | * better support remote debugging). If it is used in | |
282 | * fetch/store_inferior_registers() gdb will not complain about I/O errors | |
283 | * on fetching these registers. If all registers in REGISTER_NAMES | |
284 | * are available, then return false (0). | |
285 | */ | |
286 | ||
287 | #define CANNOT_STORE_REGISTER(regno) \ | |
288 | ((regno) == 0) || \ | |
289 | ((regno) == PCSQ_HEAD_REGNUM) || \ | |
290 | ((regno) >= PCSQ_TAIL_REGNUM && (regno) < IPSW_REGNUM) || \ | |
291 | ((regno) > IPSW_REGNUM && (regno) < FP4_REGNUM) | |
292 | ||
5140562f JG |
293 | /* This is a piece of magic that is given a register number REGNO |
294 | and as BLOCKEND the address in the system of the end of the user structure | |
295 | and stores in ADDR the address in the kernel or core dump | |
296 | of that register. */ | |
297 | ||
298 | ||
299 | /* Describe the pointer in each stack frame to the previous stack frame | |
300 | (its caller). */ | |
301 | ||
302 | /* FRAME_CHAIN takes a frame's nominal address | |
303 | and produces the frame's chain-pointer. | |
304 | ||
305 | FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address | |
306 | and produces the nominal address of the caller frame. | |
307 | ||
308 | However, if FRAME_CHAIN_VALID returns zero, | |
309 | it means the given frame is the outermost one and has no caller. | |
310 | In that case, FRAME_CHAIN_COMBINE is not used. */ | |
311 | ||
312 | /* In the case of the PA-RISC, the frame's nominal address | |
313 | is the address of a 4-byte word containing the calling frame's | |
314 | address (previous FP). */ | |
315 | ||
316 | #define FRAME_CHAIN(thisframe) \ | |
01d1590b | 317 | (!inside_entry_file ((thisframe)->pc) ? \ |
5140562f JG |
318 | read_memory_integer ((thisframe)->frame, 4) :\ |
319 | 0) | |
320 | ||
321 | #define FRAME_CHAIN_VALID(chain, thisframe) \ | |
322 | frame_chain_valid (chain, thisframe) | |
323 | ||
324 | #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) | |
325 | ||
326 | /* Define other aspects of the stack frame. */ | |
327 | ||
328 | /* A macro that tells us whether the function invocation represented | |
329 | by FI does not have a frame on the stack associated with it. If it | |
330 | does not, FRAMELESS is set to 1, else 0. */ | |
331 | #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ | |
332 | (FRAMELESS) = frameless_look_for_prologue(FI) | |
333 | ||
334 | #define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME) | |
335 | ||
336 | #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) | |
337 | ||
338 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
339 | /* Set VAL to the number of args passed to frame described by FI. | |
340 | Can set VAL to -1, meaning no way to tell. */ | |
341 | ||
342 | /* We can't tell how many args there are | |
343 | now that the C compiler delays popping them. */ | |
344 | #define FRAME_NUM_ARGS(val,fi) (val = -1) | |
345 | ||
346 | /* Return number of bytes at start of arglist that are not really args. */ | |
347 | ||
348 | #define FRAME_ARGS_SKIP 0 | |
349 | ||
350 | /* Put here the code to store, into a struct frame_saved_regs, | |
351 | the addresses of the saved registers of frame described by FRAME_INFO. | |
352 | This includes special registers such as pc and fp saved in special | |
353 | ways in the stack frame. sp is even more special: | |
354 | the address we return for it IS the sp for the next frame. */ | |
355 | ||
356 | /* Deal with dummy functions later. */ | |
357 | ||
358 | #define STW_P(INSN) (((INSN) & 0xfc000000) == 0x68000000) | |
359 | #define ADDIL_P(INSN) (((INSN) & 0xfc000000) == 0x28000000) | |
360 | #define LDO_P(INSN) (((INSN) & 0xfc00c000) == 0x34000000) | |
361 | ||
5140562f JG |
362 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ |
363 | { register int regnum; \ | |
364 | register CORE_ADDR next_addr; \ | |
365 | register CORE_ADDR pc; \ | |
366 | unsigned this_insn; \ | |
367 | unsigned address; \ | |
368 | \ | |
369 | bzero (&frame_saved_regs, sizeof frame_saved_regs); \ | |
9f739abd SG |
370 | if ((frame_info->pc >= (frame_info)->frame \ |
371 | && (frame_info)->pc <= ((frame_info)->frame + CALL_DUMMY_LENGTH \ | |
372 | + 32 * 4 + (NUM_REGS - FP0_REGNUM) * 8 \ | |
373 | + 6 * 4))) \ | |
5140562f JG |
374 | find_dummy_frame_regs ((frame_info), &(frame_saved_regs)); \ |
375 | else \ | |
376 | { pc = get_pc_function_start ((frame_info)->pc); \ | |
377 | if (read_memory_integer (pc, 4) == 0x6BC23FD9) \ | |
378 | { (frame_saved_regs).regs[RP_REGNUM] = (frame_info)->frame - 20;\ | |
379 | pc = pc + 4; \ | |
380 | } \ | |
381 | if (read_memory_integer (pc, 4) != 0x8040241) goto lose; \ | |
382 | pc += 8; /* skip "copy 4,1; copy 30, 4" */ \ | |
383 | /* skip either "stw 1,0(4);addil L'fsize,30;ldo R'fsize(1),30" \ | |
384 | or "stwm 1,fsize(30)" */ \ | |
385 | if ((read_memory_integer (pc, 4) & ~MASK_14) == 0x68810000) \ | |
386 | pc += 12; \ | |
387 | else \ | |
388 | pc += 4; \ | |
389 | while (1) \ | |
390 | { this_insn = read_memory_integer(pc, 4); \ | |
391 | if (STW_P (this_insn)) /* stw */ \ | |
392 | { regnum = GET_FIELD (this_insn, 11, 15); \ | |
393 | if (!regnum) goto lose; \ | |
394 | (frame_saved_regs).regs[regnum] = (frame_info)->frame + \ | |
395 | extract_14 (this_insn); \ | |
396 | pc += 4; \ | |
397 | } \ | |
398 | else if (ADDIL_P (this_insn)) /* addil */ \ | |
399 | { int next_insn; \ | |
400 | next_insn = read_memory_integer(pc + 4, 4); \ | |
401 | if (STW_P (next_insn)) /* stw */ \ | |
402 | { regnum = GET_FIELD (this_insn, 6, 10); \ | |
403 | if (!regnum) goto lose; \ | |
404 | (frame_saved_regs).regs[regnum] = (frame_info)->frame +\ | |
405 | (extract_21 (this_insn) << 11) + extract_14 (next_insn);\ | |
406 | pc += 8; \ | |
407 | } \ | |
408 | else \ | |
409 | break; \ | |
410 | } \ | |
411 | else \ | |
412 | { pc += 4; \ | |
413 | break; \ | |
414 | } \ | |
415 | } \ | |
416 | this_insn = read_memory_integer (pc, 4); \ | |
417 | if (LDO_P (this_insn)) \ | |
418 | { next_addr = (frame_info)->frame + extract_14 (this_insn); \ | |
419 | pc += 4; \ | |
420 | } \ | |
421 | else if (ADDIL_P (this_insn)) \ | |
422 | { next_addr = (frame_info)->frame + (extract_21 (this_insn) << 11)\ | |
423 | + extract_14 (read_memory_integer (pc + 4, 4)); \ | |
424 | pc += 8; \ | |
425 | } \ | |
426 | while (1) \ | |
427 | { this_insn = read_memory_integer (pc, 4); \ | |
428 | if ((this_insn & 0xfc001fe0) == 0x2c001220) /* fstds,ma */ \ | |
429 | { regnum = GET_FIELD (this_insn, 27, 31); \ | |
430 | (frame_saved_regs).regs[regnum + FP0_REGNUM] = next_addr; \ | |
431 | next_addr += 8; \ | |
9f739abd | 432 | pc += 4; \ |
5140562f JG |
433 | } \ |
434 | else \ | |
435 | break; \ | |
436 | } \ | |
437 | lose: \ | |
438 | (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \ | |
439 | (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame -4; \ | |
440 | }} | |
441 | \f | |
442 | /* Things needed for making the inferior call functions. */ | |
443 | ||
444 | /* Push an empty stack frame, to record the current PC, etc. */ | |
445 | ||
9f739abd | 446 | #define PUSH_DUMMY_FRAME push_dummy_frame () |
5140562f JG |
447 | |
448 | /* Discard from the stack the innermost frame, | |
449 | restoring all saved registers. */ | |
9f739abd | 450 | #define POP_FRAME hp_pop_frame () |
5140562f JG |
451 | |
452 | /* This sequence of words is the instructions | |
453 | ||
454 | ; Call stack frame has already been built by gdb. Since we could be calling | |
455 | ; a varargs function, and we do not have the benefit of a stub to put things in | |
456 | ; the right place, we load the first 4 word of arguments into both the general | |
457 | ; and fp registers. | |
458 | call_dummy | |
459 | ldw -36(sp), arg0 | |
460 | ldw -40(sp), arg1 | |
461 | ldw -44(sp), arg2 | |
462 | ldw -48(sp), arg3 | |
463 | ldo -36(sp), r1 | |
464 | fldws 0(0, r1), fr4 | |
465 | fldds -4(0, r1), fr5 | |
466 | fldws -8(0, r1), fr6 | |
467 | fldds -12(0, r1), fr7 | |
468 | ldil 0, r22 ; target will be placed here. | |
469 | ldo 0(r22), r22 | |
470 | ldsid (0,r22), r3 | |
471 | ldil 0, r1 ; _sr4export will be placed here. | |
472 | ldo 0(r1), r1 | |
9f739abd SG |
473 | ldsid (0,r1), r19 |
474 | combt,=,n r3, r19, text_space ; If target is in data space, do a | |
5140562f JG |
475 | ble 0(sr5, r22) ; "normal" procedure call |
476 | copy r31, r2 | |
477 | break 4, 8 | |
9f739abd SG |
478 | mtsp r21, sr0 |
479 | ble,n 0(sr0, r22) | |
5140562f JG |
480 | text_space ; Otherwise, go through _sr4export, |
481 | ble (sr4, r1) ; which will return back here. | |
482 | stw 31,-24(r30) | |
483 | break 4, 8 | |
9f739abd SG |
484 | mtsp r21, sr0 |
485 | ble,n 0(sr0, r22) | |
5140562f JG |
486 | |
487 | The dummy decides if the target is in text space or data space. If | |
488 | it's in data space, there's no problem because the target can | |
489 | return back to the dummy. However, if the target is in text space, | |
490 | the dummy calls the secret, undocumented routine _sr4export, which | |
491 | calls a function in text space and can return to any space. Instead | |
492 | of including fake instructions to represent saved registers, we | |
493 | know that the frame is associated with the call dummy and treat it | |
494 | specially. */ | |
495 | ||
9f739abd SG |
496 | #define CALL_DUMMY {0x4BDA3FB9, 0x4BD93FB1, 0x4BD83FA9, 0x4BD73FA1,\ |
497 | 0x37C13FB9, 0x24201004, 0x2C391005, 0x24311006,\ | |
498 | 0x2C291007, 0x22C00000, 0x36D60000, 0x02C010A3,\ | |
499 | 0x20200000, 0x34210000, 0x002010b3, 0x82632022,\ | |
500 | 0xe6c06000, 0x081f0242, 0x00010004, 0x00151820,\ | |
501 | 0xe6c00002, 0xe4202000, 0x6bdf3fd1, 0x00010004,\ | |
502 | 0x00151820, 0xe6c00002} | |
5140562f | 503 | |
9f739abd | 504 | #define CALL_DUMMY_LENGTH 104 |
5140562f | 505 | #define CALL_DUMMY_START_OFFSET 0 |
9f739abd SG |
506 | |
507 | /* | |
508 | * Insert the specified number of args and function address | |
509 | * into a call sequence of the above form stored at DUMMYNAME. | |
510 | * | |
511 | * On the hppa we need to call the stack dummy through $$dyncall. | |
512 | * Therefore our version of FIX_CALL_DUMMY takes an extra argument, | |
513 | * real_pc, which is the location where gdb should start up the | |
514 | * inferior to do the function call. | |
515 | */ | |
516 | ||
517 | #define FIX_CALL_DUMMY(dummyname, pc, real_pc, fun, nargs, args, type, gcc_p) \ | |
518 | { \ | |
519 | CORE_ADDR dyncall_addr = 0, sr4export_addr = 0; \ | |
520 | \ | |
521 | if (!dyncall_addr) \ | |
522 | { \ | |
5140562f | 523 | struct minimal_symbol *msymbol; \ |
9f739abd SG |
524 | msymbol = lookup_minimal_symbol ("$$dyncall", (struct objfile *) NULL);\ |
525 | if (msymbol == NULL) \ | |
526 | error ("Can't find an address for $$dyncall trampoline"); \ | |
527 | else \ | |
528 | dyncall_addr = msymbol -> address; \ | |
5140562f | 529 | msymbol = lookup_minimal_symbol ("_sr4export", (struct objfile *) NULL);\ |
9f739abd SG |
530 | if (msymbol == NULL) \ |
531 | error ("Can't find an address for _sr4export trampoline"); \ | |
532 | else \ | |
533 | sr4export_addr = msymbol -> address; \ | |
534 | } \ | |
535 | dummyname[9] = deposit_21 (fun >> 11, dummyname[9]); \ | |
536 | dummyname[10] = deposit_14 (fun & MASK_11, dummyname[10]); \ | |
537 | dummyname[12] = deposit_21 (sr4export_addr >> 11, \ | |
538 | dummyname[12]); \ | |
539 | dummyname[13] = deposit_14 (sr4export_addr & MASK_11, \ | |
540 | dummyname[13]); \ | |
541 | write_register (22, pc); \ | |
542 | real_pc = dyncall_addr; \ | |
5140562f JG |
543 | } |
544 | ||
e0ba1d14 JG |
545 | #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ |
546 | sp = hp_push_arguments(nargs, args, sp, struct_return, struct_addr) | |
547 | ||
e0ba1d14 JG |
548 | /* Symbol files have two symbol tables. Rather than do this right, |
549 | like the ELF symbol reading code, massive hackery was added | |
550 | to dbxread.c and partial-stab.h. This flag turns on that | |
551 | hackery, which should all go away FIXME FIXME FIXME FIXME now. */ | |
552 | ||
553 | #define GDB_TARGET_IS_HPPA | |
9f739abd SG |
554 | |
555 | /* | |
556 | * Unwind table and descriptor. | |
557 | */ | |
558 | ||
559 | struct unwind_table_entry { | |
560 | unsigned int region_start; | |
561 | unsigned int region_end; | |
562 | ||
563 | unsigned int Cannot_unwind : 1; | |
564 | unsigned int Millicode : 1; | |
565 | unsigned int Millicode_save_sr0 : 1; | |
566 | unsigned int Region_description : 2; | |
567 | unsigned int reserverd1 : 1; | |
568 | unsigned int Entry_SR : 1; | |
569 | unsigned int Entry_FR : 4; /* number saved */ | |
570 | unsigned int Entry_GR : 5; /* number saved */ | |
571 | unsigned int Args_stored : 1; | |
572 | unsigned int Variable_Frame : 1; | |
573 | unsigned int Separate_Package_Body : 1; | |
574 | unsigned int Frame_Extension_Millicode:1; | |
575 | unsigned int Stack_Overflow_Check : 1; | |
576 | unsigned int Two_Instruction_SP_Increment:1; | |
577 | unsigned int Ada_Region : 1; | |
578 | unsigned int reserved2 : 4; | |
579 | unsigned int Save_SP : 1; | |
580 | unsigned int Save_RP : 1; | |
581 | unsigned int Save_MRP_in_frame : 1; | |
582 | unsigned int extn_ptr_defined : 1; | |
583 | unsigned int Cleanup_defined : 1; | |
584 | ||
585 | unsigned int MPE_XL_interrupt_marker: 1; | |
586 | unsigned int HP_UX_interrupt_marker: 1; | |
587 | unsigned int Large_frame : 1; | |
588 | unsigned int reserved4 : 2; | |
589 | unsigned int Total_frame_size : 27; | |
590 | }; |