gdb-3.1
[deliverable/binutils-gdb.git] / gdb / m-sparc.h
1 /* Parameters for execution on a Sun 4, for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@mcc.com)
4
5 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
6 WARRANTY. No author or distributor accepts responsibility to anyone
7 for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing.
9 Refer to the GDB General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GDB,
12 but only under the conditions described in the GDB General Public
13 License. A copy of this license is supposed to have been given to you
14 along with GDB so you can know your rights and responsibilities. It
15 should be in a file named COPYING. Among other things, the copyright
16 notice and this notice must be preserved on all copies.
17
18 In other words, go ahead and share GDB, but don't try to stop
19 anyone else from sharing it farther. Help stamp out software hoarding!
20 */
21
22 #ifndef sun4
23 #define sun4
24 #endif
25
26 /* Get rid of any system-imposed stack limit if possible. */
27
28 #define SET_STACK_LIMIT_HUGE
29
30 /* Define this if the C compiler puts an underscore at the front
31 of external names before giving them to the linker. */
32
33 #define NAMES_HAVE_UNDERSCORE
34
35 /* Debugger information will be in DBX format. */
36
37 #define READ_DBX_FORMAT
38
39 /* Big or Little-Endian target machine
40 BITS: defined if bit #0 is the high-order bit of a byte.
41 BYTES:defined if byte#0 is the high-order byte of an int.
42 WORDS:defined if word#0 is the high-order word of a double. */
43 #define BITS_BIG_ENDIAN
44 #define BYTES_BIG_ENDIAN
45 #define WORDS_BIG_ENDIAN
46
47 /* Floating point is IEEE compatible. */
48 #define IEEE_FLOAT
49
50 /* Offset from address of function to start of its code.
51 Zero on most machines. */
52
53 #define FUNCTION_START_OFFSET 0
54
55 /* Advance PC across any function entry prologue instructions
56 to reach some "real" code. */
57
58 #define SKIP_PROLOGUE(pc) \
59 { pc = skip_prologue (pc); }
60
61 /* Immediately after a function call, return the saved pc.
62 Can't go through the frames for this because on some machines
63 the new frame is not set up until the new function executes
64 some instructions. */
65
66 /* On the Sun 4 under SunOS, the compile will leave a fake insn which
67 encodes the structure size being returned. If we detect such
68 a fake insn, step past it. */
69
70 #define PC_ADJUST(pc) ((read_memory_integer (pc + 8, 4) & 0xfffffe00) == 0 ? \
71 pc+12 : pc+8)
72
73 #define SAVED_PC_AFTER_CALL(frame) PC_ADJUST (read_register (RP_REGNUM))
74
75 /* Address of end of stack space. */
76
77 #define STACK_END_ADDR 0xf8000000
78
79 /* Stack grows downward. */
80
81 #define INNER_THAN <
82
83 /* Stack has strict alignment. */
84
85 #define STACK_ALIGN(ADDR) (((ADDR)+7)&-8)
86
87 /* Sequence of bytes for breakpoint instruction. */
88
89 #define BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
90
91 /* Amount PC must be decremented by after a breakpoint.
92 This is often the number of bytes in BREAKPOINT
93 but not always. */
94
95 #define DECR_PC_AFTER_BREAK 0
96
97 /* Nonzero if instruction at PC is a return instruction. */
98 /* For SPARC, this is either a "jmpl %o7+8,%g0" or "jmpl %i7+8,%g0".
99
100 Note: this does not work for functions returning structures under SunOS. */
101 #define ABOUT_TO_RETURN(pc) \
102 ((read_memory_integer (pc, 4)|0x00040000) == 0x81c7e008)
103
104 /* Return 1 if P points to an invalid floating point value. */
105
106 #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */
107
108 /* Largest integer type */
109 #define LONGEST long
110
111 /* Name of the builtin type for the LONGEST type above. */
112 #define BUILTIN_TYPE_LONGEST builtin_type_long
113
114 /* Say how long (ordinary) registers are. */
115
116 #define REGISTER_TYPE long
117
118 /* Number of machine registers */
119
120 #define NUM_REGS 72
121
122 /* Initializer for an array of names of registers.
123 There should be NUM_REGS strings in this initializer. */
124
125 #define REGISTER_NAMES \
126 { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
127 "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \
128 "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
129 "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", \
130 \
131 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
132 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
133 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
134 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
135 \
136 "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr" };
137
138 /* Register numbers of various important registers.
139 Note that some of these values are "real" register numbers,
140 and correspond to the general registers of the machine,
141 and some are "phony" register numbers which are too large
142 to be actual register numbers as far as the user is concerned
143 but do serve to get the desired values when passed to read_register. */
144
145 #define FP_REGNUM 30 /* Contains address of executing stack frame */
146 #define RP_REGNUM 15 /* Contains return address value, *before* \
147 any windows get switched. */
148 #define SP_REGNUM 14 /* Contains address of top of stack, \
149 which is also the bottom of the frame. */
150 #define Y_REGNUM 64 /* Temp register for multiplication, etc. */
151 #define PS_REGNUM 65 /* Contains processor status */
152 #define PC_REGNUM 68 /* Contains program counter */
153 #define NPC_REGNUM 69 /* Contains next PC */
154 #define FP0_REGNUM 32 /* Floating point register 0 */
155 #define FPS_REGNUM 70 /* Floating point status register */
156 #define CPS_REGNUM 71 /* Coprocessor status register */
157
158 /* Total amount of space needed to store our copies of the machine's
159 register state, the array `registers'. */
160 #define REGISTER_BYTES (32*4+32*4+8*4)
161
162 /* Index within `registers' of the first byte of the space for
163 register N. */
164 /* ?? */
165 #define REGISTER_BYTE(N) ((N)*4)
166
167 /* The SPARC processor has register windows. */
168
169 #define HAVE_REGISTER_WINDOWS
170
171 /* Is this register part of the register window system? A yes answer
172 implies that 1) The name of this register will not be the same in
173 other frames, and 2) This register is automatically "saved" (out
174 registers shifting into ins counts) upon subroutine calls and thus
175 there is no need to search more than one stack frame for it. */
176
177 #define REGISTER_IN_WINDOW_P(regnum) \
178 ((regnum) >= 8 && (regnum) < 32)
179
180 /* Number of bytes of storage in the actual machine representation
181 for register N. */
182
183 /* On the SPARC, all regs are 4 bytes. */
184
185 #define REGISTER_RAW_SIZE(N) (4)
186
187 /* Number of bytes of storage in the program's representation
188 for register N. */
189
190 /* On the SPARC, all regs are 4 bytes. */
191
192 #define REGISTER_VIRTUAL_SIZE(N) (4)
193
194 /* Largest value REGISTER_RAW_SIZE can have. */
195
196 #define MAX_REGISTER_RAW_SIZE 8
197
198 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
199
200 #define MAX_REGISTER_VIRTUAL_SIZE 8
201
202 /* Nonzero if register N requires conversion
203 from raw format to virtual format. */
204
205 #define REGISTER_CONVERTIBLE(N) (0)
206
207 /* Convert data from raw format for register REGNUM
208 to virtual format for register REGNUM. */
209
210 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
211 { bcopy ((FROM), (TO), 4); }
212
213 /* Convert data from virtual format for register REGNUM
214 to raw format for register REGNUM. */
215
216 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
217 { bcopy ((FROM), (TO), 4); }
218
219 /* Return the GDB type object for the "standard" data type
220 of data in register N. */
221
222 #define REGISTER_VIRTUAL_TYPE(N) \
223 ((N) < 32 ? builtin_type_int : (N) < 64 ? builtin_type_float : \
224 builtin_type_int)
225
226 /* Store the address of the place in which to copy the structure the
227 subroutine will return. This is called from call_function. */
228
229 #define STORE_STRUCT_RETURN(ADDR, SP) \
230 { write_memory ((SP)+(16*4), &(ADDR), 4); }
231
232 /* Extract from an array REGBUF containing the (raw) register state
233 a function return value of type TYPE, and copy that, in virtual format,
234 into VALBUF. */
235
236 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
237 bcopy (((int *)(REGBUF))+8, (VALBUF), TYPE_LENGTH (TYPE))
238
239 /* Write into appropriate registers a function return value
240 of type TYPE, given in virtual format. */
241 /* On sparc, values are returned in register %o0. */
242 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
243 write_register_bytes (REGISTER_BYTE (8), VALBUF, TYPE_LENGTH (TYPE))
244
245 /* Extract from an array REGBUF containing the (raw) register state
246 the address in which a function should return its structure value,
247 as a CORE_ADDR (or an expression that can be used as one). */
248
249 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
250 (read_memory_integer (((int *)(REGBUF))[SP_REGNUM]+(16*4), 4))
251
252 /* Enable use of alternate code to read and write registers. */
253
254 #define NEW_SUN_PTRACE
255
256 /* Enable use of alternate code for Sun's format of core dump file. */
257
258 #define NEW_SUN_CORE
259
260 /* Do implement the attach and detach commands. */
261
262 #define ATTACH_DETACH
263
264 /* It is safe to look for symsegs on a Sun, because Sun's ld
265 does not screw up with random garbage at end of file. */
266
267 #define READ_GDB_SYMSEGS
268
269 \f
270 /* Describe the pointer in each stack frame to the previous stack frame
271 (its caller). */
272 #include <machine/reg.h>
273
274 #define GET_RWINDOW_REG(FRAME, REG) \
275 (read_memory_integer (&((struct rwindow *)FRAME)->REG, 4))
276
277 /* FRAME_CHAIN takes a frame's nominal address
278 and produces the frame's chain-pointer.
279
280 FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
281 and produces the nominal address of the caller frame.
282
283 However, if FRAME_CHAIN_VALID returns zero,
284 it means the given frame is the outermost one and has no caller.
285 In that case, FRAME_CHAIN_COMBINE is not used. */
286
287 /* In the case of the Sun 4, the frame-chain's nominal address
288 is held in the frame pointer register.
289
290 On the Sun4, the frame (in %fp) is %sp for the previous frame.
291 From the previous frame's %sp, we can find the previous frame's
292 %fp: it is in the save area just above the previous frame's %sp.
293
294 If we are setting up an arbitrary frame, we'll need to know where
295 it ends. Hence the following. This part of the frame cache
296 structure should be checked before it is assumed that this frame's
297 bottom is in the stack pointer.
298
299 If there isn't a frame below this one, the bottom of this frame is
300 in the stack pointer.
301
302 If there is a frame below this one, and the frame pointers are
303 identical, it's a leaf frame and the bottoms are the same also.
304
305 Otherwise the bottom of this frame is the top of the next frame. */
306
307 #define EXTRA_FRAME_INFO FRAME_ADDR bottom;
308 #define INIT_EXTRA_FRAME_INFO(fci) \
309 (fci)->bottom = \
310 ((fci)->next ? \
311 ((fci)->frame == (fci)->next_frame ? \
312 (fci)->next->bottom : (fci)->next->frame) : \
313 read_register (SP_REGNUM));
314
315 #define FRAME_CHAIN(thisframe) \
316 GET_RWINDOW_REG ((thisframe)->frame, rw_in[6])
317
318 /* Avoid checking FRAME_SAVED_PC since that screws us due to
319 improperly set up saved PC on a signal trampoline call */
320 #if 0
321 #define FRAME_CHAIN_VALID(chain, thisframe) \
322 (chain != 0 && (FRAME_SAVED_PC (thisframe) >= first_object_file_end))
323 #else
324 #define FRAME_CHAIN_VALID(chain, thisframe) \
325 (chain != 0)
326 #endif
327
328 #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
329
330 /* Define other aspects of the stack frame. */
331
332 /* Where is the PC for a specific frame */
333
334 #define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME)
335
336 /* If the argument is on the stack, it will be here. */
337 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
338
339 #define FRAME_STRUCT_ARGS_ADDRESS(fi) ((fi)->frame)
340
341 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
342
343 /* Set VAL to the number of args passed to frame described by FI.
344 Can set VAL to -1, meaning no way to tell. */
345
346 /* We can't tell how many args there are
347 now that the C compiler delays popping them. */
348 #define FRAME_NUM_ARGS(val,fi) (val = -1)
349
350 /* Return number of bytes at start of arglist that are not really args. */
351
352 #define FRAME_ARGS_SKIP 68
353
354 /* Put here the code to store, into a struct frame_saved_regs,
355 the addresses of the saved registers of frame described by FRAME_INFO.
356 This includes special registers such as pc and fp saved in special
357 ways in the stack frame. sp is even more special:
358 the address we return for it IS the sp for the next frame.
359
360 Note that on register window machines, we are currently making the
361 assumption that window registers are being saved somewhere in the
362 frame in which they are being used. If they are stored in an
363 inferior frame, find_saved_register will break.
364
365 On the Sun 4, the only time all registers are saved is when
366 a dummy frame is involved. Otherwise, the only saved registers
367 are the LOCAL and IN registers which are saved as a result
368 of the "save/restore" opcodes. This condition is determined
369 by address rather than by value. */
370
371 #define FRAME_FIND_SAVED_REGS(fi, frame_saved_regs) \
372 { register int regnum; \
373 register CORE_ADDR pc; \
374 FRAME_ADDR frame = read_register (FP_REGNUM); \
375 FRAME fid = FRAME_INFO_ID (fi); \
376 if (!fid) fatal ("Bad frame info struct in FRAME_FIND_SAVED_REGS"); \
377 bzero (&(frame_saved_regs), sizeof (frame_saved_regs)); \
378 if ((fi)->pc >= frame - CALL_DUMMY_LENGTH - 0x140 \
379 && (fi)->pc <= frame) \
380 { \
381 for (regnum = 1; regnum < 8; regnum++) \
382 (frame_saved_regs).regs[regnum] = \
383 frame + regnum * 4 - 0xa0; \
384 for (regnum = 24; regnum < 32; regnum++) \
385 (frame_saved_regs).regs[regnum] = \
386 frame + (regnum - 24) * 4 - 0xc0; \
387 for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 32; regnum++) \
388 (frame_saved_regs).regs[regnum] = \
389 frame + (regnum - FP0_REGNUM) * 4 - 0x80; \
390 for (regnum = 64; regnum < NUM_REGS; regnum++) \
391 (frame_saved_regs).regs[regnum] = \
392 frame + (regnum - 64) * 4 - 0xe0; \
393 frame = (fi)->bottom ? \
394 (fi)->bottom : read_register (SP_REGNUM); \
395 } \
396 else \
397 { \
398 frame = (fi)->bottom ? \
399 (fi)->bottom : read_register (SP_REGNUM); \
400 for (regnum = 16; regnum < 32; regnum++) \
401 (frame_saved_regs).regs[regnum] = frame + (regnum-16) * 4; \
402 } \
403 if ((fi)->next) \
404 { \
405 /* Pull off either the next frame pointer or \
406 the stack pointer */ \
407 FRAME_ADDR next_next_frame = \
408 ((fi)->next->bottom ? \
409 (fi)->next->bottom : \
410 read_register (SP_REGNUM)); \
411 for (regnum = 8; regnum < 16; regnum++) \
412 (frame_saved_regs).regs[regnum] = next_next_frame + regnum * 4; \
413 } \
414 /* Otherwise, whatever we would get from ptrace(GETREGS) */ \
415 /* is accurate */ \
416 for (regnum = 30; regnum < 32; regnum++) \
417 (frame_saved_regs).regs[regnum] = frame + (regnum-16) * 4; \
418 (frame_saved_regs).regs[SP_REGNUM] = frame; \
419 (frame_saved_regs).regs[PC_REGNUM] = frame + 15*4; \
420 }
421 \f
422 /* Things needed for making the inferior call functions. */
423 /*
424 * First of all, let me give my opinion of what the DUMMY_FRAME
425 * actually looks like.
426 *
427 * | |
428 * | |
429 * + - - - - - - - - - - - - - - - - +<-- fp (level 0)
430 * | |
431 * | |
432 * | |
433 * | |
434 * | Frame of innermost program |
435 * | function |
436 * | |
437 * | |
438 * | |
439 * | |
440 * | |
441 * |---------------------------------|<-- sp (level 0), fp (c)
442 * | |
443 * DUMMY | fp0-31 |
444 * | |
445 * | ------ |<-- fp - 0x80
446 * FRAME | g0-7 |<-- fp - 0xa0
447 * | i0-7 |<-- fp - 0xc0
448 * | other |<-- fp - 0xe0
449 * | ? |
450 * | ? |
451 * |---------------------------------|<-- sp' = fp - 0x140
452 * | |
453 * xcution start | |
454 * sp' + 0x94 -->| CALL_DUMMY (x code) |
455 * | |
456 * | |
457 * |---------------------------------|<-- sp'' = fp - 0x200
458 * | align sp to 8 byte boundary |
459 * | ==> args to fn <== |
460 * Room for | |
461 * i & l's + agg | CALL_DUMMY_STACK_ADJUST = 0x0x44|
462 * |---------------------------------|<-- final sp (variable)
463 * | |
464 * | Where function called will |
465 * | build frame. |
466 * | |
467 * | |
468 *
469 * I understand everything in this picture except what the space
470 * between fp - 0xe0 and fp - 0x140 is used for. Oh, and I don't
471 * understand why there's a large chunk of CALL_DUMMY that never gets
472 * executed (its function is superceeded by PUSH_DUMMY_FRAME; they
473 * are designed to do the same thing).
474 *
475 * PUSH_DUMMY_FRAME saves the registers above sp' and pushes the
476 * register file stack down one.
477 *
478 * call_function then writes CALL_DUMMY, pushes the args onto the
479 * stack, and adjusts the stack pointer.
480 *
481 * run_stack_dummy then starts execution (in the middle of
482 * CALL_DUMMY, as directed by call_function).
483 */
484
485 /* Push an empty stack frame, to record the current PC, etc. */
486
487 /* Note: to be perfectly correct, we have to restore the
488 IN registers (which were the OUT registers of the calling frame). */
489 /* Note that the write's are of registers in the context of the newly
490 pushed frame. Thus the the fp*'s, the g*'s, the i*'s, and
491 the others, of the new frame, are being saved.
492 The locals are new; they don't need to be saved. The i's and l's of
493 the last frame were saved by the do_save_insn in the register
494 file (ie. on the stack, since a context switch happended imm after) */
495 /* We note that the return pointer register does not *need* to have
496 the pc saved into it (return from this frame will be accomplished
497 by a POP_FRAME), however, just in case it might be needed, we will
498 leave it. However, we will write the original value of RP into the
499 location on the stack for saving i7 (what rp turns into upon call);
500 this way we don't loose the value with our function call. */
501 /* Note that the pc saved must be 8 less than the actual pc, since
502 both POP_FRAME and the normal return sequence on the sparc return
503 to 8 more than the value of RP_REGNUM */
504
505 #define PUSH_DUMMY_FRAME \
506 { extern char registers[]; \
507 register int regnum; \
508 CORE_ADDR fp = read_register (FP_REGNUM); \
509 CORE_ADDR pc = read_register (PC_REGNUM) - 8; \
510 CORE_ADDR rp = read_register (RP_REGNUM); \
511 void do_save_insn (); \
512 supply_register (RP_REGNUM, &pc); \
513 do_save_insn (0x140); \
514 fp = read_register (FP_REGNUM); \
515 write_memory (fp - 0x80, &registers[REGISTER_BYTE (FP0_REGNUM)], 32 * 4);\
516 write_memory (fp - 0xa0, &registers[REGISTER_BYTE (0)], 8 * 4); \
517 write_memory (fp - 0xc0, &registers[REGISTER_BYTE (24)], 7 * 4); \
518 write_memory (fp - 0xa4, &rp, 4); \
519 write_memory (fp - 0xe0, &registers[REGISTER_BYTE (64)], 8 * 4); \
520 }
521
522 /* Discard from the stack the innermost frame,
523 restoring all saved registers.
524 Note that the values stored in fsr by get_frame_saved_regs are *in
525 the context of the inferior frame*. What this means is that the i
526 regs of fsr must be restored into the o regs of the frame popped
527 into. We don't care about the output regs of the inferior frame.
528
529 This is true for dummy frames. Is it true for normal frames? It
530 really does appear so. */
531
532 #define POP_FRAME \
533 { register FRAME frame = get_current_frame (); \
534 register CORE_ADDR fp; \
535 register CORE_ADDR pc; \
536 register int regnum; \
537 struct frame_saved_regs fsr; \
538 struct frame_info *fi; \
539 char raw_buffer[REGISTER_BYTES]; \
540 void do_restore_insn (); \
541 fi = get_frame_info (frame); \
542 fp = fi->frame; \
543 get_frame_saved_regs (fi, &fsr); \
544 pc = read_memory_integer (fsr.regs[PC_REGNUM], 4); \
545 do_restore_insn (PC_ADJUST (pc)); \
546 if (fsr.regs[FP0_REGNUM]) \
547 { \
548 read_memory (fsr.regs[FP0_REGNUM], raw_buffer, 32 * 4); \
549 write_register_bytes (REGISTER_BYTE (FP0_REGNUM), raw_buffer, 32 * 4); \
550 } \
551 if (fsr.regs[1]) \
552 { \
553 read_memory (fsr.regs[1], raw_buffer, 7 * 4); \
554 write_register_bytes (REGISTER_BYTE (1), raw_buffer, 7 * 4); \
555 } \
556 if (fsr.regs[24]) \
557 { \
558 read_memory (fsr.regs[24], raw_buffer, 8 * 4); \
559 write_register_bytes (REGISTER_BYTE (8), raw_buffer, 8 * 4); \
560 } \
561 if (fsr.regs[PS_REGNUM]) \
562 write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \
563 if (fsr.regs[Y_REGNUM]) \
564 write_register (Y_REGNUM, read_memory_integer (fsr.regs[Y_REGNUM], 4)); \
565 if (fsr.regs[NPC_REGNUM]) \
566 write_register (NPC_REGNUM, read_memory_integer (fsr.regs[NPC_REGNUM], 4)); \
567 flush_cached_frames (); \
568 set_current_frame ( create_new_frame (read_register (FP_REGNUM), \
569 read_pc ())); }
570
571 /* This sequence of words is the instructions
572
573 save %sp,-0x140,%sp
574 std %f30,[%fp-0x08]
575 std %f28,[%fp-0x10]
576 std %f26,[%fp-0x18]
577 std %f24,[%fp-0x20]
578 std %f22,[%fp-0x28]
579 std %f20,[%fp-0x30]
580 std %f18,[%fp-0x38]
581 std %f16,[%fp-0x40]
582 std %f14,[%fp-0x48]
583 std %f12,[%fp-0x50]
584 std %f10,[%fp-0x58]
585 std %f8,[%fp-0x60]
586 std %f6,[%fp-0x68]
587 std %f4,[%fp-0x70]
588 std %f2,[%fp-0x78]
589 std %f0,[%fp-0x80]
590 std %g6,[%fp-0x88]
591 std %g4,[%fp-0x90]
592 std %g2,[%fp-0x98]
593 std %g0,[%fp-0xa0]
594 std %i6,[%fp-0xa8]
595 std %i4,[%fp-0xb0]
596 std %i2,[%fp-0xb8]
597 std %i0,[%fp-0xc0]
598 nop ! stcsr [%fp-0xc4]
599 nop ! stfsr [%fp-0xc8]
600 nop ! wr %npc,[%fp-0xcc]
601 nop ! wr %pc,[%fp-0xd0]
602 rd %tbr,%o0
603 st %o0,[%fp-0xd4]
604 rd %wim,%o1
605 st %o0,[%fp-0xd8]
606 rd %psr,%o0
607 st %o0,[%fp-0xdc]
608 rd %y,%o0
609 st %o0,[%fp-0xe0]
610
611 /..* The arguments are pushed at this point by GDB;
612 no code is needed in the dummy for this.
613 The CALL_DUMMY_START_OFFSET gives the position of
614 the following ld instruction. *../
615
616 ld [%sp+0x58],%o5
617 ld [%sp+0x54],%o4
618 ld [%sp+0x50],%o3
619 ld [%sp+0x4c],%o2
620 ld [%sp+0x48],%o1
621 call 0x00000000
622 ld [%sp+0x44],%o0
623 nop
624 ta 1
625 nop
626
627 note that this is 192 bytes, which is a multiple of 8 (not only 4) bytes.
628 note that the `call' insn is a relative, not an absolute call.
629 note that the `nop' at the end is needed to keep the trap from
630 clobbering things (if NPC pointed to garbage instead).
631
632 We actually start executing at the `sethi', since the pushing of the
633 registers (as arguments) is done by PUSH_DUMMY_FRAME. If this were
634 real code, the arguments for the function called by the CALL would be
635 pushed between the list of ST insns and the CALL, and we could allow
636 it to execute through. But the arguments have to be pushed by GDB
637 after the PUSH_DUMMY_FRAME is done, and we cannot allow these ST
638 insns to be performed again, lest the registers saved be taken for
639 arguments. */
640
641 #define CALL_DUMMY { 0x9de3bee0, 0xfd3fbff8, 0xf93fbff0, 0xf53fbfe8, \
642 0xf13fbfe0, 0xed3fbfd8, 0xe93fbfd0, 0xe53fbfc8, \
643 0xe13fbfc0, 0xdd3fbfb8, 0xd93fbfb0, 0xd53fbfa8, \
644 0xd13fbfa0, 0xcd3fbf98, 0xc93fbf90, 0xc53fbf88, \
645 0xc13fbf80, 0xcc3fbf78, 0xc83fbf70, 0xc43fbf68, \
646 0xc03fbf60, 0xfc3fbf58, 0xf83fbf50, 0xf43fbf48, \
647 0xf03fbf40, 0x01000000, 0x01000000, 0x01000000, \
648 0x01000000, 0x91580000, 0xd027bf50, 0x93500000, \
649 0xd027bf4c, 0x91480000, 0xd027bf48, 0x91400000, \
650 0xd027bf44, 0xda03a058, 0xd803a054, 0xd603a050, \
651 0xd403a04c, 0xd203a048, 0x40000000, 0xd003a044, \
652 0x01000000, 0x91d02001, 0x01000000, 0x01000000}
653
654 #define CALL_DUMMY_LENGTH 192
655
656 #define CALL_DUMMY_START_OFFSET 148
657
658 #define CALL_DUMMY_STACK_ADJUST 68
659
660 /* Insert the specified number of args and function address
661 into a call sequence of the above form stored at DUMMYNAME. */
662
663 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, type) \
664 { \
665 *(int *)((char *) dummyname+168) = (0x40000000|((fun-(pc+168))>>2)); \
666 if (TYPE_CODE (type) == TYPE_CODE_STRUCT \
667 || TYPE_CODE (type) == TYPE_CODE_UNION) \
668 *(int *)((char *) dummyname+176) = (TYPE_LENGTH (type) & 0x1fff); \
669 }
670
671 \f
672 /* Sparc has no reliable single step ptrace call */
673
674 #define NO_SINGLE_STEP 1
675
676 /* It does have a wait structure, and it might help things out . . . */
677
678 #define HAVE_WAIT_STRUCT
679
680 /* Handle a feature in the sun4 compiler ("call .stret4" at the end of
681 functions returning structures). */
682
683 #define SUN4_COMPILER_FEATURE
684
685 /* We need two arguments (in general) to the "info frame" command.
686 Note that the definition of this macro implies that there exists a
687 function "setup_arbitrary_frame" in mach-dep.c */
688
689 #define FRAME_SPECIFICATION_DYADIC
690
691 /* KDB stuff flushed for now. */
This page took 0.04661 seconds and 4 git commands to generate.