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