]>
Commit | Line | Data |
---|---|---|
dd3b648e | 1 | /* Parameters for target machine of Sun 4, for GDB, the GNU debugger. |
fbcb5095 | 2 | Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. |
dd3b648e | 3 | Contributed by Michael Tiemann ([email protected]) |
fbcb5095 | 4 | |
dd3b648e RP |
5 | This file is part of GDB. |
6 | ||
99a7de40 | 7 | This program is free software; you can redistribute it and/or modify |
dd3b648e | 8 | it under the terms of the GNU General Public License as published by |
99a7de40 JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
dd3b648e | 11 | |
99a7de40 | 12 | This program is distributed in the hope that it will be useful, |
dd3b648e RP |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
99a7de40 JG |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
dd3b648e RP |
20 | |
21 | #define TARGET_BYTE_ORDER BIG_ENDIAN | |
22 | ||
23 | /* Floating point is IEEE compatible. */ | |
24 | #define IEEE_FLOAT | |
25 | ||
26 | /* Define this if the C compiler puts an underscore at the front | |
27 | of external names before giving them to the linker. */ | |
28 | ||
29 | #define NAMES_HAVE_UNDERSCORE | |
30 | ||
dd3b648e RP |
31 | /* When passing a structure to a function, Sun cc passes the address |
32 | in a register, not the structure itself. It (under SunOS4) creates | |
33 | two symbols, so we get a LOC_ARG saying the address is on the stack | |
34 | (a lie, and a serious one since we don't know which register to | |
35 | use), and a LOC_REGISTER saying that the struct is in a register | |
5d98a45f JK |
36 | (sort of a lie, but fixable with REG_STRUCT_HAS_ADDR). Gcc version |
37 | two (as of 1.92) behaves like sun cc, but I don't know how we can | |
38 | distinguish between gcc version 1 and gcc version 2. | |
dd3b648e RP |
39 | |
40 | This still doesn't work if the argument is not one passed in a | |
41 | register (i.e. it's the 7th or later argument). */ | |
42 | #define REG_STRUCT_HAS_ADDR(gcc_p) (!(gcc_p)) | |
43 | #define STRUCT_ARG_SYM_GARBAGE(gcc_p) (!(gcc_p)) | |
44 | ||
45 | /* If Pcc says that a parameter is a short, it's a short. This is | |
46 | because the parameter does get passed in in a register as an int, | |
47 | but pcc puts it onto the stack frame as a short (not nailing | |
48 | whatever else might be there. I'm not sure that I consider this | |
49 | swift. Sigh.) | |
50 | ||
51 | No, don't do this. The problem here is that pcc says that the | |
52 | argument is in the upper half of the word reserved on the stack, | |
53 | but puts it in the lower half. */ | |
54 | /* #define BELIEVE_PCC_PROMOTION 1 */ | |
55 | /* OK, I've added code to dbxread.c to deal with this case. */ | |
56 | #define BELIEVE_PCC_PROMOTION_TYPE | |
57 | ||
58 | /* Offset from address of function to start of its code. | |
59 | Zero on most machines. */ | |
60 | ||
61 | #define FUNCTION_START_OFFSET 0 | |
62 | ||
63 | /* Advance PC across any function entry prologue instructions | |
5259796b JG |
64 | to reach some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances |
65 | the PC past some of the prologue, but stops as soon as it | |
66 | knows that the function has a frame. Its result is equal | |
67 | to its input PC if the function is frameless, unequal otherwise. */ | |
dd3b648e RP |
68 | |
69 | #define SKIP_PROLOGUE(pc) \ | |
5259796b JG |
70 | { pc = skip_prologue (pc, 0); } |
71 | #define SKIP_PROLOGUE_FRAMELESS_P(pc) \ | |
72 | { pc = skip_prologue (pc, 1); } | |
dd3b648e RP |
73 | extern CORE_ADDR skip_prologue (); |
74 | ||
75 | /* Immediately after a function call, return the saved pc. | |
76 | Can't go through the frames for this because on some machines | |
77 | the new frame is not set up until the new function executes | |
78 | some instructions. */ | |
79 | ||
80 | /* On the Sun 4 under SunOS, the compile will leave a fake insn which | |
81 | encodes the structure size being returned. If we detect such | |
82 | a fake insn, step past it. */ | |
83 | ||
5e5215eb JG |
84 | #define PC_ADJUST(pc) sparc_pc_adjust(pc) |
85 | extern CORE_ADDR sparc_pc_adjust(); | |
dd3b648e RP |
86 | |
87 | #define SAVED_PC_AFTER_CALL(frame) PC_ADJUST (read_register (RP_REGNUM)) | |
88 | ||
89 | /* Address of the end of stack space. We get this from the system | |
90 | include files. */ | |
91 | #include <sys/types.h> | |
92 | #include <machine/vmparam.h> | |
93 | #define STACK_END_ADDR USRSTACK | |
94 | ||
95 | #define INNER_THAN < | |
96 | ||
97 | /* Stack has strict alignment. */ | |
98 | ||
99 | #define STACK_ALIGN(ADDR) (((ADDR)+7)&-8) | |
100 | ||
101 | /* Sequence of bytes for breakpoint instruction. */ | |
102 | ||
103 | #define BREAKPOINT {0x91, 0xd0, 0x20, 0x01} | |
104 | ||
105 | /* Amount PC must be decremented by after a breakpoint. | |
106 | This is often the number of bytes in BREAKPOINT | |
107 | but not always. */ | |
108 | ||
109 | #define DECR_PC_AFTER_BREAK 0 | |
110 | ||
111 | /* Nonzero if instruction at PC is a return instruction. */ | |
112 | /* For SPARC, this is either a "jmpl %o7+8,%g0" or "jmpl %i7+8,%g0". | |
113 | ||
114 | Note: this does not work for functions returning structures under SunOS. */ | |
115 | #define ABOUT_TO_RETURN(pc) \ | |
116 | ((read_memory_integer (pc, 4)|0x00040000) == 0x81c7e008) | |
117 | ||
118 | /* Return 1 if P points to an invalid floating point value. */ | |
119 | ||
120 | #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ | |
121 | ||
122 | /* Say how long (ordinary) registers are. */ | |
123 | ||
124 | #define REGISTER_TYPE long | |
125 | ||
126 | /* Number of machine registers */ | |
127 | ||
128 | #define NUM_REGS 72 | |
129 | ||
130 | /* Initializer for an array of names of registers. | |
131 | There should be NUM_REGS strings in this initializer. */ | |
132 | ||
133 | #define REGISTER_NAMES \ | |
134 | { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ | |
135 | "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \ | |
136 | "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ | |
137 | "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", \ | |
138 | \ | |
139 | "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ | |
140 | "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ | |
141 | "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ | |
142 | "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ | |
143 | \ | |
144 | "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr" }; | |
145 | ||
146 | /* Register numbers of various important registers. | |
147 | Note that some of these values are "real" register numbers, | |
148 | and correspond to the general registers of the machine, | |
149 | and some are "phony" register numbers which are too large | |
150 | to be actual register numbers as far as the user is concerned | |
151 | but do serve to get the desired values when passed to read_register. */ | |
152 | ||
153 | #define G0_REGNUM 0 /* %g0 */ | |
154 | #define G1_REGNUM 1 /* %g1 */ | |
155 | #define O0_REGNUM 8 /* %o0 */ | |
156 | #define SP_REGNUM 14 /* Contains address of top of stack, \ | |
157 | which is also the bottom of the frame. */ | |
158 | #define RP_REGNUM 15 /* Contains return address value, *before* \ | |
159 | any windows get switched. */ | |
160 | #define O7_REGNUM 15 /* Last local reg not saved on stack frame */ | |
161 | #define L0_REGNUM 16 /* First local reg that's saved on stack frame | |
162 | rather than in machine registers */ | |
163 | #define I0_REGNUM 24 /* %i0 */ | |
164 | #define FP_REGNUM 30 /* Contains address of executing stack frame */ | |
165 | #define I7_REGNUM 31 /* Last local reg saved on stack frame */ | |
166 | #define FP0_REGNUM 32 /* Floating point register 0 */ | |
167 | #define Y_REGNUM 64 /* Temp register for multiplication, etc. */ | |
168 | #define PS_REGNUM 65 /* Contains processor status */ | |
169 | #define WIM_REGNUM 66 /* Window Invalid Mask (not really supported) */ | |
170 | #define TBR_REGNUM 67 /* Trap Base Register (not really supported) */ | |
171 | #define PC_REGNUM 68 /* Contains program counter */ | |
172 | #define NPC_REGNUM 69 /* Contains next PC */ | |
173 | #define FPS_REGNUM 70 /* Floating point status register */ | |
174 | #define CPS_REGNUM 71 /* Coprocessor status register */ | |
175 | ||
176 | /* Total amount of space needed to store our copies of the machine's | |
177 | register state, the array `registers'. */ | |
178 | #define REGISTER_BYTES (32*4+32*4+8*4) | |
179 | ||
180 | /* Index within `registers' of the first byte of the space for | |
181 | register N. */ | |
182 | /* ?? */ | |
183 | #define REGISTER_BYTE(N) ((N)*4) | |
184 | ||
185 | /* The SPARC processor has register windows. */ | |
186 | ||
187 | #define HAVE_REGISTER_WINDOWS | |
188 | ||
189 | /* Is this register part of the register window system? A yes answer | |
190 | implies that 1) The name of this register will not be the same in | |
191 | other frames, and 2) This register is automatically "saved" (out | |
192 | registers shifting into ins counts) upon subroutine calls and thus | |
193 | there is no need to search more than one stack frame for it. */ | |
194 | ||
195 | #define REGISTER_IN_WINDOW_P(regnum) \ | |
196 | ((regnum) >= 8 && (regnum) < 32) | |
197 | ||
198 | /* Number of bytes of storage in the actual machine representation | |
199 | for register N. */ | |
200 | ||
201 | /* On the SPARC, all regs are 4 bytes. */ | |
202 | ||
203 | #define REGISTER_RAW_SIZE(N) (4) | |
204 | ||
205 | /* Number of bytes of storage in the program's representation | |
206 | for register N. */ | |
207 | ||
208 | /* On the SPARC, all regs are 4 bytes. */ | |
209 | ||
210 | #define REGISTER_VIRTUAL_SIZE(N) (4) | |
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 | { bcopy ((FROM), (TO), 4); } | |
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 | { bcopy ((FROM), (TO), 4); } | |
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) < 32 ? builtin_type_int : (N) < 64 ? builtin_type_float : \ | |
242 | builtin_type_int) | |
243 | ||
244 | /* Writing to %g0 is a noop (not an error or exception or anything like | |
245 | that, however). */ | |
246 | ||
247 | #define CANNOT_STORE_REGISTER(regno) ((regno) == G0_REGNUM) | |
248 | ||
249 | /* Store the address of the place in which to copy the structure the | |
250 | subroutine will return. This is called from call_function. */ | |
251 | ||
252 | #define STORE_STRUCT_RETURN(ADDR, SP) \ | |
253 | { target_write_memory ((SP)+(16*4), (char *)&(ADDR), 4); } | |
254 | ||
255 | /* Extract from an array REGBUF containing the (raw) register state | |
256 | a function return value of type TYPE, and copy that, in virtual format, | |
257 | into VALBUF. */ | |
258 | ||
259 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
260 | { \ | |
261 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ | |
262 | { \ | |
263 | bcopy (((int *)(REGBUF))+FP0_REGNUM, \ | |
264 | (VALBUF), TYPE_LENGTH(TYPE)); \ | |
265 | } \ | |
266 | else \ | |
5ab580cc SG |
267 | bcopy ((char *)(REGBUF) + 4 * 8 + \ |
268 | (TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)), \ | |
269 | (VALBUF), TYPE_LENGTH(TYPE)); \ | |
dd3b648e RP |
270 | } |
271 | ||
272 | /* Write into appropriate registers a function return value | |
273 | of type TYPE, given in virtual format. */ | |
274 | /* On sparc, values are returned in register %o0. */ | |
275 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
276 | { \ | |
277 | if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ | |
278 | /* Floating-point values are returned in the register pair */ \ | |
279 | /* formed by %f0 and %f1 (doubles are, anyway). */ \ | |
280 | write_register_bytes (REGISTER_BYTE (FP0_REGNUM), (VALBUF), \ | |
281 | TYPE_LENGTH (TYPE)); \ | |
282 | else \ | |
283 | /* Other values are returned in register %o0. */ \ | |
284 | write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \ | |
285 | TYPE_LENGTH (TYPE)); \ | |
286 | } | |
287 | ||
288 | /* Extract from an array REGBUF containing the (raw) register state | |
289 | the address in which a function should return its structure value, | |
290 | as a CORE_ADDR (or an expression that can be used as one). */ | |
291 | ||
292 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ | |
e1ce8aa5 JK |
293 | (sparc_extract_struct_value_address (REGBUF)) |
294 | CORE_ADDR sparc_extract_struct_value_address ( | |
295 | #ifdef __STDC__ | |
296 | char [REGISTER_BYTES] | |
297 | #endif | |
298 | ); | |
dd3b648e RP |
299 | |
300 | \f | |
301 | /* Describe the pointer in each stack frame to the previous stack frame | |
302 | (its caller). */ | |
303 | ||
9a822037 JK |
304 | /* If you're not compiling this on a sun, you'll have to get a copy |
305 | of <sun4/reg.h> (also known as <machine/reg.h>). */ | |
306 | #include <sun4/reg.h> | |
dd3b648e | 307 | |
dd3b648e RP |
308 | /* FRAME_CHAIN takes a frame's nominal address |
309 | and produces the frame's chain-pointer. | |
310 | ||
311 | FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address | |
312 | and produces the nominal address of the caller frame. | |
313 | ||
314 | However, if FRAME_CHAIN_VALID returns zero, | |
315 | it means the given frame is the outermost one and has no caller. | |
316 | In that case, FRAME_CHAIN_COMBINE is not used. */ | |
317 | ||
318 | /* In the case of the Sun 4, the frame-chain's nominal address | |
319 | is held in the frame pointer register. | |
320 | ||
321 | On the Sun4, the frame (in %fp) is %sp for the previous frame. | |
322 | From the previous frame's %sp, we can find the previous frame's | |
323 | %fp: it is in the save area just above the previous frame's %sp. | |
324 | ||
325 | If we are setting up an arbitrary frame, we'll need to know where | |
326 | it ends. Hence the following. This part of the frame cache | |
327 | structure should be checked before it is assumed that this frame's | |
328 | bottom is in the stack pointer. | |
329 | ||
330 | If there isn't a frame below this one, the bottom of this frame is | |
331 | in the stack pointer. | |
332 | ||
333 | If there is a frame below this one, and the frame pointers are | |
334 | identical, it's a leaf frame and the bottoms are the same also. | |
335 | ||
336 | Otherwise the bottom of this frame is the top of the next frame. */ | |
337 | ||
338 | #define EXTRA_FRAME_INFO FRAME_ADDR bottom; | |
a23075bc | 339 | #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \ |
dd3b648e RP |
340 | (fci)->bottom = \ |
341 | ((fci)->next ? \ | |
342 | ((fci)->frame == (fci)->next_frame ? \ | |
343 | (fci)->next->bottom : (fci)->next->frame) : \ | |
344 | read_register (SP_REGNUM)); | |
345 | ||
e1ce8aa5 JK |
346 | #define FRAME_CHAIN(thisframe) (sparc_frame_chain (thisframe)) |
347 | CORE_ADDR sparc_frame_chain (); | |
dd3b648e RP |
348 | |
349 | #define FRAME_CHAIN_VALID(chain, thisframe) \ | |
350 | (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe)))) | |
351 | ||
352 | #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) | |
353 | ||
354 | /* Define other aspects of the stack frame. */ | |
355 | ||
356 | /* A macro that tells us whether the function invocation represented | |
357 | by FI does not have a frame on the stack associated with it. If it | |
358 | does not, FRAMELESS is set to 1, else 0. */ | |
359 | #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ | |
360 | (FRAMELESS) = frameless_look_for_prologue(FI) | |
361 | ||
362 | /* Where is the PC for a specific frame */ | |
363 | ||
364 | #define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME) | |
365 | CORE_ADDR frame_saved_pc (); | |
366 | ||
367 | /* If the argument is on the stack, it will be here. */ | |
368 | #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) | |
369 | ||
370 | #define FRAME_STRUCT_ARGS_ADDRESS(fi) ((fi)->frame) | |
371 | ||
372 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
373 | ||
374 | /* Set VAL to the number of args passed to frame described by FI. | |
375 | Can set VAL to -1, meaning no way to tell. */ | |
376 | ||
377 | /* We can't tell how many args there are | |
378 | now that the C compiler delays popping them. */ | |
379 | #define FRAME_NUM_ARGS(val,fi) (val = -1) | |
380 | ||
381 | /* Return number of bytes at start of arglist that are not really args. */ | |
382 | ||
383 | #define FRAME_ARGS_SKIP 68 | |
384 | ||
385 | /* Put here the code to store, into a struct frame_saved_regs, | |
386 | the addresses of the saved registers of frame described by FRAME_INFO. | |
387 | The actual code is in sparc-tdep.c so we can debug it sanely. */ | |
388 | ||
389 | #define FRAME_FIND_SAVED_REGS(fi, frame_saved_regs) \ | |
390 | sparc_frame_find_saved_regs ((fi), &(frame_saved_regs)) | |
391 | extern void sparc_frame_find_saved_regs (); | |
392 | \f | |
393 | /* Things needed for making the inferior call functions. */ | |
394 | /* | |
395 | * First of all, let me give my opinion of what the DUMMY_FRAME | |
396 | * actually looks like. | |
397 | * | |
398 | * | | | |
399 | * | | | |
400 | * + - - - - - - - - - - - - - - - - +<-- fp (level 0) | |
401 | * | | | |
402 | * | | | |
403 | * | | | |
404 | * | | | |
405 | * | Frame of innermost program | | |
406 | * | function | | |
407 | * | | | |
408 | * | | | |
409 | * | | | |
410 | * | | | |
411 | * | | | |
412 | * |---------------------------------|<-- sp (level 0), fp (c) | |
413 | * | | | |
414 | * DUMMY | fp0-31 | | |
415 | * | | | |
416 | * | ------ |<-- fp - 0x80 | |
417 | * FRAME | g0-7 |<-- fp - 0xa0 | |
418 | * | i0-7 |<-- fp - 0xc0 | |
419 | * | other |<-- fp - 0xe0 | |
420 | * | ? | | |
421 | * | ? | | |
422 | * |---------------------------------|<-- sp' = fp - 0x140 | |
423 | * | | | |
424 | * xcution start | | | |
425 | * sp' + 0x94 -->| CALL_DUMMY (x code) | | |
426 | * | | | |
427 | * | | | |
428 | * |---------------------------------|<-- sp'' = fp - 0x200 | |
429 | * | align sp to 8 byte boundary | | |
430 | * | ==> args to fn <== | | |
431 | * Room for | | | |
432 | * i & l's + agg | CALL_DUMMY_STACK_ADJUST = 0x0x44| | |
433 | * |---------------------------------|<-- final sp (variable) | |
434 | * | | | |
435 | * | Where function called will | | |
436 | * | build frame. | | |
437 | * | | | |
438 | * | | | |
439 | * | |
440 | * I understand everything in this picture except what the space | |
441 | * between fp - 0xe0 and fp - 0x140 is used for. Oh, and I don't | |
442 | * understand why there's a large chunk of CALL_DUMMY that never gets | |
443 | * executed (its function is superceeded by PUSH_DUMMY_FRAME; they | |
444 | * are designed to do the same thing). | |
445 | * | |
446 | * PUSH_DUMMY_FRAME saves the registers above sp' and pushes the | |
447 | * register file stack down one. | |
448 | * | |
449 | * call_function then writes CALL_DUMMY, pushes the args onto the | |
450 | * stack, and adjusts the stack pointer. | |
451 | * | |
452 | * run_stack_dummy then starts execution (in the middle of | |
453 | * CALL_DUMMY, as directed by call_function). | |
454 | */ | |
455 | ||
456 | /* Push an empty stack frame, to record the current PC, etc. */ | |
457 | ||
458 | #define PUSH_DUMMY_FRAME sparc_push_dummy_frame () | |
459 | #define POP_FRAME sparc_pop_frame () | |
460 | ||
461 | void sparc_push_dummy_frame (), sparc_pop_frame (); | |
462 | /* This sequence of words is the instructions | |
463 | ||
464 | save %sp,-0x140,%sp | |
465 | std %f30,[%fp-0x08] | |
466 | std %f28,[%fp-0x10] | |
467 | std %f26,[%fp-0x18] | |
468 | std %f24,[%fp-0x20] | |
469 | std %f22,[%fp-0x28] | |
470 | std %f20,[%fp-0x30] | |
471 | std %f18,[%fp-0x38] | |
472 | std %f16,[%fp-0x40] | |
473 | std %f14,[%fp-0x48] | |
474 | std %f12,[%fp-0x50] | |
475 | std %f10,[%fp-0x58] | |
476 | std %f8,[%fp-0x60] | |
477 | std %f6,[%fp-0x68] | |
478 | std %f4,[%fp-0x70] | |
479 | std %f2,[%fp-0x78] | |
480 | std %f0,[%fp-0x80] | |
481 | std %g6,[%fp-0x88] | |
482 | std %g4,[%fp-0x90] | |
483 | std %g2,[%fp-0x98] | |
484 | std %g0,[%fp-0xa0] | |
485 | std %i6,[%fp-0xa8] | |
486 | std %i4,[%fp-0xb0] | |
487 | std %i2,[%fp-0xb8] | |
488 | std %i0,[%fp-0xc0] | |
489 | nop ! stcsr [%fp-0xc4] | |
490 | nop ! stfsr [%fp-0xc8] | |
491 | nop ! wr %npc,[%fp-0xcc] | |
492 | nop ! wr %pc,[%fp-0xd0] | |
493 | rd %tbr,%o0 | |
494 | st %o0,[%fp-0xd4] | |
495 | rd %wim,%o1 | |
496 | st %o0,[%fp-0xd8] | |
497 | rd %psr,%o0 | |
498 | st %o0,[%fp-0xdc] | |
499 | rd %y,%o0 | |
500 | st %o0,[%fp-0xe0] | |
501 | ||
502 | /..* The arguments are pushed at this point by GDB; | |
503 | no code is needed in the dummy for this. | |
504 | The CALL_DUMMY_START_OFFSET gives the position of | |
505 | the following ld instruction. *../ | |
506 | ||
507 | ld [%sp+0x58],%o5 | |
508 | ld [%sp+0x54],%o4 | |
509 | ld [%sp+0x50],%o3 | |
510 | ld [%sp+0x4c],%o2 | |
511 | ld [%sp+0x48],%o1 | |
512 | call 0x00000000 | |
513 | ld [%sp+0x44],%o0 | |
514 | nop | |
515 | ta 1 | |
516 | nop | |
517 | ||
518 | note that this is 192 bytes, which is a multiple of 8 (not only 4) bytes. | |
519 | note that the `call' insn is a relative, not an absolute call. | |
520 | note that the `nop' at the end is needed to keep the trap from | |
521 | clobbering things (if NPC pointed to garbage instead). | |
522 | ||
523 | We actually start executing at the `sethi', since the pushing of the | |
524 | registers (as arguments) is done by PUSH_DUMMY_FRAME. If this were | |
525 | real code, the arguments for the function called by the CALL would be | |
526 | pushed between the list of ST insns and the CALL, and we could allow | |
527 | it to execute through. But the arguments have to be pushed by GDB | |
528 | after the PUSH_DUMMY_FRAME is done, and we cannot allow these ST | |
529 | insns to be performed again, lest the registers saved be taken for | |
530 | arguments. */ | |
531 | ||
532 | #define CALL_DUMMY { 0x9de3bee0, 0xfd3fbff8, 0xf93fbff0, 0xf53fbfe8, \ | |
533 | 0xf13fbfe0, 0xed3fbfd8, 0xe93fbfd0, 0xe53fbfc8, \ | |
534 | 0xe13fbfc0, 0xdd3fbfb8, 0xd93fbfb0, 0xd53fbfa8, \ | |
535 | 0xd13fbfa0, 0xcd3fbf98, 0xc93fbf90, 0xc53fbf88, \ | |
536 | 0xc13fbf80, 0xcc3fbf78, 0xc83fbf70, 0xc43fbf68, \ | |
537 | 0xc03fbf60, 0xfc3fbf58, 0xf83fbf50, 0xf43fbf48, \ | |
538 | 0xf03fbf40, 0x01000000, 0x01000000, 0x01000000, \ | |
539 | 0x01000000, 0x91580000, 0xd027bf50, 0x93500000, \ | |
540 | 0xd027bf4c, 0x91480000, 0xd027bf48, 0x91400000, \ | |
541 | 0xd027bf44, 0xda03a058, 0xd803a054, 0xd603a050, \ | |
542 | 0xd403a04c, 0xd203a048, 0x40000000, 0xd003a044, \ | |
543 | 0x01000000, 0x91d02001, 0x01000000, 0x01000000} | |
544 | ||
545 | #define CALL_DUMMY_LENGTH 192 | |
546 | ||
547 | #define CALL_DUMMY_START_OFFSET 148 | |
548 | ||
549 | #define CALL_DUMMY_STACK_ADJUST 68 | |
550 | ||
551 | /* Insert the specified number of args and function address | |
552 | into a call sequence of the above form stored at DUMMYNAME. | |
553 | ||
554 | For structs and unions, if the function was compiled with Sun cc, | |
555 | it expects 'unimp' after the call. But gcc doesn't use that | |
556 | (twisted) convention. So leave a nop there for gcc (FIX_CALL_DUMMY | |
557 | can assume it is operating on a pristine CALL_DUMMY, not one that | |
558 | has already been customized for a different function). */ | |
559 | ||
560 | #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ | |
561 | { \ | |
562 | *(int *)((char *) dummyname+168) = (0x40000000|((fun-(pc+168))>>2)); \ | |
563 | if (!gcc_p \ | |
564 | && (TYPE_CODE (type) == TYPE_CODE_STRUCT \ | |
565 | || TYPE_CODE (type) == TYPE_CODE_UNION)) \ | |
566 | *(int *)((char *) dummyname+176) = (TYPE_LENGTH (type) & 0x1fff); \ | |
567 | } | |
568 | ||
569 | \f | |
570 | /* Sparc has no reliable single step ptrace call */ | |
571 | ||
572 | #define NO_SINGLE_STEP 1 | |
573 | extern void single_step (); | |
574 | ||
575 | /* We need two arguments (in general) to the "info frame" command. | |
576 | Note that the definition of this macro implies that there exists a | |
5259796b | 577 | function "setup_arbitrary_frame" in sparc-tdep.c */ |
dd3b648e RP |
578 | |
579 | #define FRAME_SPECIFICATION_DYADIC | |
580 | ||
581 | /* To print every pair of float registers as a double, we use this hook. */ | |
582 | ||
583 | #define PRINT_REGISTER_HOOK(regno) \ | |
584 | if (((regno) >= FP0_REGNUM) \ | |
585 | && ((regno) < FP0_REGNUM + 32) \ | |
586 | && (0 == (regno & 1))) { \ | |
587 | char doublereg[8]; /* two float regs */ \ | |
588 | if (!read_relative_register_raw_bytes (i , doublereg ) \ | |
589 | && !read_relative_register_raw_bytes (i+1, doublereg+4)) { \ | |
590 | printf("\t"); \ | |
591 | print_floating (doublereg, builtin_type_double, stdout); \ | |
592 | } \ | |
593 | } | |
594 |