1 /* Target-machine dependent code for the AMD 29000
2 Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
3 Contributed by Cygnus Support. Written by Jim Kingdon.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
29 /* If all these bits in an instruction word are zero, it is a "tag word"
30 which precedes a function entry point and gives stack traceback info.
31 This used to be defined as 0xff000000, but that treated 0x00000deb as
32 a tag word, while it is really used as a breakpoint. */
33 #define TAGWORD_ZERO_MASK 0xff00f800
35 extern CORE_ADDR text_start
; /* FIXME, kludge... */
37 /* The user-settable top of the register stack in virtual memory. We
38 won't attempt to access any stored registers above this address, if set
41 static CORE_ADDR rstack_high_address
= UINT_MAX
;
43 /* Structure to hold cached info about function prologues. */
46 CORE_ADDR pc
; /* First addr after fn prologue */
47 unsigned rsize
, msize
; /* register stack frame size, mem stack ditto */
48 unsigned mfp_used
: 1; /* memory frame pointer used */
49 unsigned rsize_valid
: 1; /* Validity bits for the above */
50 unsigned msize_valid
: 1;
51 unsigned mfp_valid
: 1;
54 /* Examine the prologue of a function which starts at PC. Return
55 the first addess past the prologue. If MSIZE is non-NULL, then
56 set *MSIZE to the memory stack frame size. If RSIZE is non-NULL,
57 then set *RSIZE to the register stack frame size (not including
58 incoming arguments and the return address & frame pointer stored
59 with them). If no prologue is found, *RSIZE is set to zero.
60 If no prologue is found, or a prologue which doesn't involve
61 allocating a memory stack frame, then set *MSIZE to zero.
63 Note that both msize and rsize are in bytes. This is not consistent
64 with the _User's Manual_ with respect to rsize, but it is much more
67 If MFP_USED is non-NULL, *MFP_USED is set to nonzero if a memory
68 frame pointer is being used. */
70 examine_prologue (pc
, rsize
, msize
, mfp_used
)
78 struct minimal_symbol
*msymbol
= lookup_minimal_symbol_by_pc (pc
);
79 struct prologue_info
*mi
= 0;
82 mi
= (struct prologue_info
*) msymbol
-> info
;
90 valid
&= mi
->rsize_valid
;
95 valid
&= mi
->msize_valid
;
99 *mfp_used
= mi
->mfp_used
;
100 valid
&= mi
->mfp_valid
;
110 if (mfp_used
!= NULL
)
113 /* Prologue must start with subtracting a constant from gr1.
114 Normally this is sub gr1,gr1,<rsize * 4>. */
115 insn
= read_memory_integer (p
, 4);
116 if ((insn
& 0xffffff00) != 0x25010100)
118 /* If the frame is large, instead of a single instruction it
119 might be a pair of instructions:
120 const <reg>, <rsize * 4>
124 /* Possible value for rsize. */
127 if ((insn
& 0xff000000) != 0x03000000)
132 reg
= (insn
>> 8) & 0xff;
133 rsize0
= (((insn
>> 8) & 0xff00) | (insn
& 0xff));
135 insn
= read_memory_integer (p
, 4);
136 if ((insn
& 0xffffff00) != 0x24010100
137 || (insn
& 0xff) != reg
)
148 *rsize
= (insn
& 0xff);
152 /* Next instruction ought to be asgeu V_SPILL,gr1,rab.
153 * We don't check the vector number to allow for kernel debugging. The
154 * kernel will use a different trap number.
155 * If this insn is missing, we just keep going; Metaware R2.3u compiler
156 * generates prologue that intermixes initializations and puts the asgeu
159 insn
= read_memory_integer (p
, 4);
160 if ((insn
& 0xff00ffff) == (0x5e000100|RAB_HW_REGNUM
))
165 /* Next instruction usually sets the frame pointer (lr1) by adding
166 <size * 4> from gr1. However, this can (and high C does) be
167 deferred until anytime before the first function call. So it is
168 OK if we don't see anything which sets lr1.
169 To allow for alternate register sets (gcc -mkernel-registers) the msp
170 register number is a compile time constant. */
172 /* Normally this is just add lr1,gr1,<size * 4>. */
173 insn
= read_memory_integer (p
, 4);
174 if ((insn
& 0xffffff00) == 0x15810100)
178 /* However, for large frames it can be
179 const <reg>, <size *4>
185 if ((insn
& 0xff000000) == 0x03000000)
187 reg
= (insn
>> 8) & 0xff;
189 insn
= read_memory_integer (q
, 4);
190 if ((insn
& 0xffffff00) == 0x14810100
191 && (insn
& 0xff) == reg
)
196 /* Next comes "add lr{<rsize-1>},msp,0", but only if a memory
197 frame pointer is in use. We just check for add lr<anything>,msp,0;
198 we don't check this rsize against the first instruction, and
199 we don't check that the trace-back tag indicates a memory frame pointer
201 To allow for alternate register sets (gcc -mkernel-registers) the msp
202 register number is a compile time constant.
204 The recommended instruction is actually "sll lr<whatever>,msp,0".
205 We check for that, too. Originally Jim Kingdon's code seemed
206 to be looking for a "sub" instruction here, but the mask was set
207 up to lose all the time. */
208 insn
= read_memory_integer (p
, 4);
209 if (((insn
& 0xff80ffff) == (0x15800000|(MSP_HW_REGNUM
<<8))) /* add */
210 || ((insn
& 0xff80ffff) == (0x81800000|(MSP_HW_REGNUM
<<8)))) /* sll */
213 if (mfp_used
!= NULL
)
217 /* Next comes a subtraction from msp to allocate a memory frame,
218 but only if a memory frame is
219 being used. We don't check msize against the trace-back tag.
221 To allow for alternate register sets (gcc -mkernel-registers) the msp
222 register number is a compile time constant.
224 Normally this is just
227 insn
= read_memory_integer (p
, 4);
228 if ((insn
& 0xffffff00) ==
229 (0x25000000|(MSP_HW_REGNUM
<<16)|(MSP_HW_REGNUM
<<8)))
233 *msize
= insn
& 0xff;
237 /* For large frames, instead of a single instruction it might
241 consth <reg>, <msize> ; optional
248 if ((insn
& 0xff000000) == 0x03000000)
250 reg
= (insn
>> 8) & 0xff;
251 msize0
= ((insn
>> 8) & 0xff00) | (insn
& 0xff);
253 insn
= read_memory_integer (q
, 4);
254 /* Check for consth. */
255 if ((insn
& 0xff000000) == 0x02000000
256 && (insn
& 0x0000ff00) == reg
)
258 msize0
|= (insn
<< 8) & 0xff000000;
259 msize0
|= (insn
<< 16) & 0x00ff0000;
261 insn
= read_memory_integer (q
, 4);
263 /* Check for sub msp,msp,<reg>. */
264 if ((insn
& 0xffffff00) ==
265 (0x24000000|(MSP_HW_REGNUM
<<16)|(MSP_HW_REGNUM
<<8))
266 && (insn
& 0xff) == reg
)
275 /* Next instruction might be asgeu V_SPILL,gr1,rab.
276 * We don't check the vector number to allow for kernel debugging. The
277 * kernel will use a different trap number.
278 * Metaware R2.3u compiler
279 * generates prologue that intermixes initializations and puts the asgeu
280 * way down after everything else.
282 insn
= read_memory_integer (p
, 4);
283 if ((insn
& 0xff00ffff) == (0x5e000100|RAB_HW_REGNUM
))
293 /* Add a new cache entry. */
294 mi
= (struct prologue_info
*)xmalloc (sizeof (struct prologue_info
));
295 msymbol
-> info
= (char *)mi
;
300 /* else, cache entry exists, but info is incomplete. */
312 if (mfp_used
!= NULL
)
314 mi
->mfp_used
= *mfp_used
;
321 /* Advance PC across any function entry prologue instructions
322 to reach some "real" code. */
328 return examine_prologue (pc
, (unsigned *)NULL
, (unsigned *)NULL
,
332 * Examine the one or two word tag at the beginning of a function.
333 * The tag word is expect to be at 'p', if it is not there, we fail
334 * by returning 0. The documentation for the tag word was taken from
335 * page 7-15 of the 29050 User's Manual. We are assuming that the
336 * m bit is in bit 22 of the tag word, which seems to be the agreed upon
337 * convention today (1/15/92).
338 * msize is return in bytes.
340 static int /* 0/1 - failure/success of finding the tag word */
341 examine_tag(p
, is_trans
, argcount
, msize
, mfp_used
)
348 unsigned int tag1
, tag2
;
350 tag1
= read_memory_integer (p
, 4);
351 if ((tag1
& TAGWORD_ZERO_MASK
) != 0) /* Not a tag word */
353 if (tag1
& (1<<23)) /* A two word tag */
355 tag2
= read_memory_integer (p
+4, 4);
359 else /* A one word tag */
362 *msize
= tag1
& 0x7ff;
365 *is_trans
= ((tag1
& (1<<21)) ? 1 : 0);
367 *argcount
= (tag1
>> 16) & 0x1f;
369 *mfp_used
= ((tag1
& (1<<22)) ? 1 : 0);
373 /* Initialize the frame. In addition to setting "extra" frame info,
374 we also set ->frame because we use it in a nonstandard way, and ->pc
375 because we need to know it to get the other stuff. See the diagram
376 of stacks and the frame cache in tm-a29k.h for more detail. */
378 init_frame_info (innermost_frame
, fci
)
380 struct frame_info
*fci
;
392 fci
->frame
= read_register (GR1_REGNUM
);
394 fci
->frame
= fci
->next
->frame
+ fci
->next
->rsize
;
396 #if CALL_DUMMY_LOCATION == ON_STACK
399 if (PC_IN_CALL_DUMMY (p
, 0, 0))
402 fci
->rsize
= DUMMY_FRAME_RSIZE
;
403 /* This doesn't matter since we never try to get locals or args
404 from a dummy frame. */
406 /* Dummy frames always use a memory frame pointer. */
408 read_register_stack_integer (fci
->frame
+ DUMMY_FRAME_RSIZE
- 4, 4);
409 fci
->flags
|= (TRANSPARENT
|MFP_USED
);
413 func
= find_pc_function (p
);
415 p
= BLOCK_START (SYMBOL_BLOCK_VALUE (func
));
418 /* Search backward to find the trace-back tag. However,
419 do not trace back beyond the start of the text segment
420 (just as a sanity check to avoid going into never-never land). */
421 while (p
>= text_start
422 && ((insn
= read_memory_integer (p
, 4)) & TAGWORD_ZERO_MASK
) != 0)
427 /* Couldn't find the trace-back tag.
428 Something strange is going on. */
432 fci
->flags
= TRANSPARENT
;
436 /* Advance to the first word of the function, i.e. the word
437 after the trace-back tag. */
441 /* We've found the start of the function.
442 Try looking for a tag word that indicates whether there is a
443 memory frame pointer and what the memory stack allocation is.
444 If one doesn't exist, try using a more exhaustive search of
447 if (examine_tag(p
-4,&trans
,(int *)NULL
,&msize
,&mfp_used
)) /* Found good tag */
448 examine_prologue (p
, &rsize
, 0, 0);
449 else /* No tag try prologue */
450 examine_prologue (p
, &rsize
, &msize
, &mfp_used
);
456 fci
->flags
|= MFP_USED
;
458 fci
->flags
|= TRANSPARENT
;
461 fci
->saved_msp
= read_register (MSP_REGNUM
) + msize
;
467 read_register_stack_integer (fci
->frame
+ rsize
- 4, 4);
469 fci
->saved_msp
= fci
->next
->saved_msp
+ msize
;
474 init_extra_frame_info (fci
)
475 struct frame_info
*fci
;
478 /* Assume innermost frame. May produce strange results for "info frame"
479 but there isn't any way to tell the difference. */
480 init_frame_info (1, fci
);
482 /* We're in get_prev_frame_info.
483 Take care of everything in init_frame_pc. */
489 init_frame_pc (fromleaf
, fci
)
491 struct frame_info
*fci
;
493 fci
->pc
= (fromleaf
? SAVED_PC_AFTER_CALL (fci
->next
) :
494 fci
->next
? FRAME_SAVED_PC (fci
->next
) : read_pc ());
495 init_frame_info (fromleaf
, fci
);
498 /* Local variables (i.e. LOC_LOCAL) are on the memory stack, with their
499 offsets being relative to the memory stack pointer (high C) or
503 frame_locals_address (fi
)
504 struct frame_info
*fi
;
506 if (fi
->flags
& MFP_USED
)
507 return fi
->saved_msp
;
509 return fi
->saved_msp
- fi
->msize
;
512 /* Routines for reading the register stack. The caller gets to treat
513 the register stack as a uniform stack in memory, from address $gr1
514 straight through $rfb and beyond. */
516 /* Analogous to read_memory except the length is understood to be 4.
517 Also, myaddr can be NULL (meaning don't bother to read), and
518 if actual_mem_addr is non-NULL, store there the address that it
519 was fetched from (or if from a register the offset within
520 registers). Set *LVAL to lval_memory or lval_register, depending
521 on where it came from. The contents written into MYADDR are in
524 read_register_stack (memaddr
, myaddr
, actual_mem_addr
, lval
)
527 CORE_ADDR
*actual_mem_addr
;
528 enum lval_type
*lval
;
530 long rfb
= read_register (RFB_REGNUM
);
531 long rsp
= read_register (RSP_REGNUM
);
533 /* If we don't do this 'info register' stops in the middle. */
534 if (memaddr
>= rstack_high_address
)
537 static char val
[] = {~0, ~0, ~0, ~0};
538 /* It's in a local register, but off the end of the stack. */
539 int regnum
= (memaddr
- rsp
) / 4 + LR0_REGNUM
;
542 /* Provide bogusness */
543 memcpy (myaddr
, val
, 4);
545 supply_register(regnum
, val
); /* More bogusness */
547 *lval
= lval_register
;
548 if (actual_mem_addr
!= NULL
)
549 *actual_mem_addr
= REGISTER_BYTE (regnum
);
551 /* If it's in the part of the register stack that's in real registers,
552 get the value from the registers. If it's anywhere else in memory
553 (e.g. in another thread's saved stack), skip this part and get
554 it from real live memory. */
555 else if (memaddr
< rfb
&& memaddr
>= rsp
)
557 /* It's in a register. */
558 int regnum
= (memaddr
- rsp
) / 4 + LR0_REGNUM
;
559 if (regnum
> LR0_REGNUM
+ 127)
560 error ("Attempt to read register stack out of range.");
562 read_register_gen (regnum
, myaddr
);
564 *lval
= lval_register
;
565 if (actual_mem_addr
!= NULL
)
566 *actual_mem_addr
= REGISTER_BYTE (regnum
);
570 /* It's in the memory portion of the register stack. */
572 read_memory (memaddr
, myaddr
, 4);
575 if (actual_mem_addr
!= NULL
)
576 *actual_mem_addr
= memaddr
;
580 /* Analogous to read_memory_integer
581 except the length is understood to be 4. */
583 read_register_stack_integer (memaddr
, len
)
588 read_register_stack (memaddr
, buf
, NULL
, NULL
);
589 return extract_signed_integer (buf
, 4);
592 /* Copy 4 bytes from GDB memory at MYADDR into inferior memory
593 at MEMADDR and put the actual address written into in
596 write_register_stack (memaddr
, myaddr
, actual_mem_addr
)
599 CORE_ADDR
*actual_mem_addr
;
601 long rfb
= read_register (RFB_REGNUM
);
602 long rsp
= read_register (RSP_REGNUM
);
603 /* If we don't do this 'info register' stops in the middle. */
604 if (memaddr
>= rstack_high_address
)
606 /* It's in a register, but off the end of the stack. */
607 if (actual_mem_addr
!= NULL
)
608 *actual_mem_addr
= 0;
610 else if (memaddr
< rfb
)
612 /* It's in a register. */
613 int regnum
= (memaddr
- rsp
) / 4 + LR0_REGNUM
;
614 if (regnum
< LR0_REGNUM
|| regnum
> LR0_REGNUM
+ 127)
615 error ("Attempt to read register stack out of range.");
617 write_register (regnum
, *(long *)myaddr
);
618 if (actual_mem_addr
!= NULL
)
619 *actual_mem_addr
= 0;
623 /* It's in the memory portion of the register stack. */
625 write_memory (memaddr
, myaddr
, 4);
626 if (actual_mem_addr
!= NULL
)
627 *actual_mem_addr
= memaddr
;
631 /* Find register number REGNUM relative to FRAME and put its
632 (raw) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable
633 was optimized out (and thus can't be fetched). If the variable
634 was fetched from memory, set *ADDRP to where it was fetched from,
635 otherwise it was fetched from a register.
637 The argument RAW_BUFFER must point to aligned memory. */
639 get_saved_register (raw_buffer
, optimized
, addrp
, frame
, regnum
, lvalp
)
645 enum lval_type
*lvalp
;
647 struct frame_info
*fi
;
654 fi
= get_frame_info (frame
);
656 /* Once something has a register number, it doesn't get optimized out. */
657 if (optimized
!= NULL
)
659 if (regnum
== RSP_REGNUM
)
661 if (raw_buffer
!= NULL
)
663 store_address (raw_buffer
, REGISTER_RAW_SIZE (regnum
), fi
->frame
);
669 else if (regnum
== PC_REGNUM
)
671 if (raw_buffer
!= NULL
)
673 store_address (raw_buffer
, REGISTER_RAW_SIZE (regnum
), fi
->pc
);
676 /* Not sure we have to do this. */
682 else if (regnum
== MSP_REGNUM
)
684 if (raw_buffer
!= NULL
)
686 if (fi
->next
!= NULL
)
688 store_address (raw_buffer
, REGISTER_RAW_SIZE (regnum
),
689 fi
->next
->saved_msp
);
692 read_register_gen (MSP_REGNUM
, raw_buffer
);
694 /* The value may have been computed, not fetched. */
699 else if (regnum
< LR0_REGNUM
|| regnum
>= LR0_REGNUM
+ 128)
701 /* These registers are not saved over procedure calls,
702 so just print out the current values. */
703 if (raw_buffer
!= NULL
)
704 read_register_gen (regnum
, raw_buffer
);
706 *lvalp
= lval_register
;
708 *addrp
= REGISTER_BYTE (regnum
);
712 addr
= fi
->frame
+ (regnum
- LR0_REGNUM
) * 4;
713 if (raw_buffer
!= NULL
)
714 read_register_stack (addr
, raw_buffer
, &addr
, &lval
);
722 /* Discard from the stack the innermost frame,
723 restoring all saved registers. */
728 FRAME frame
= get_current_frame ();
729 struct frame_info
*fi
= get_frame_info (frame
);
730 CORE_ADDR rfb
= read_register (RFB_REGNUM
);
731 CORE_ADDR gr1
= fi
->frame
+ fi
->rsize
;
733 CORE_ADDR original_lr0
;
734 int must_fix_lr0
= 0;
737 /* If popping a dummy frame, need to restore registers. */
738 if (PC_IN_CALL_DUMMY (read_register (PC_REGNUM
),
739 read_register (SP_REGNUM
),
742 int lrnum
= LR0_REGNUM
+ DUMMY_ARG
/4;
743 for (i
= 0; i
< DUMMY_SAVE_SR128
; ++i
)
744 write_register (SR_REGNUM (i
+ 128),read_register (lrnum
++));
745 for (i
= 0; i
< DUMMY_SAVE_SR160
; ++i
)
746 write_register (SR_REGNUM(i
+160), read_register (lrnum
++));
747 for (i
= 0; i
< DUMMY_SAVE_GREGS
; ++i
)
748 write_register (RETURN_REGNUM
+ i
, read_register (lrnum
++));
749 /* Restore the PCs and prepare to restore LR0. */
750 write_register(PC_REGNUM
, read_register (lrnum
++));
751 write_register(NPC_REGNUM
, read_register (lrnum
++));
752 write_register(PC2_REGNUM
, read_register (lrnum
++));
753 original_lr0
= read_register (lrnum
++);
757 /* Restore the memory stack pointer. */
758 write_register (MSP_REGNUM
, fi
->saved_msp
);
759 /* Restore the register stack pointer. */
760 write_register (GR1_REGNUM
, gr1
);
762 /* If we popped a dummy frame, restore lr0 now that gr1 has been restored. */
764 write_register (LR0_REGNUM
, original_lr0
);
766 /* Check whether we need to fill registers. */
767 lr1
= read_register (LR0_REGNUM
+ 1);
771 int num_bytes
= lr1
- rfb
;
774 write_register (RAB_REGNUM
, read_register (RAB_REGNUM
) + num_bytes
);
775 write_register (RFB_REGNUM
, lr1
);
776 for (i
= 0; i
< num_bytes
; i
+= 4)
778 /* Note: word is in host byte order. */
779 word
= read_memory_integer (rfb
+ i
, 4);
780 write_register (LR0_REGNUM
+ ((rfb
- gr1
) % 0x80) + i
/ 4, word
);
783 flush_cached_frames ();
784 set_current_frame (create_new_frame (0, read_pc()));
787 /* Push an empty stack frame, to record the current PC, etc. */
794 CORE_ADDR msp
= read_register (MSP_REGNUM
);
796 CORE_ADDR original_lr0
;
798 /* Read original lr0 before changing gr1. This order isn't really needed
799 since GDB happens to have a snapshot of all the regs and doesn't toss
800 it when gr1 is changed. But it's The Right Thing To Do. */
801 original_lr0
= read_register (LR0_REGNUM
);
803 /* Allocate the new frame. */
804 gr1
= read_register (GR1_REGNUM
) - DUMMY_FRAME_RSIZE
;
805 write_register (GR1_REGNUM
, gr1
);
807 rab
= read_register (RAB_REGNUM
);
810 /* We need to spill registers. */
811 int num_bytes
= rab
- gr1
;
812 CORE_ADDR rfb
= read_register (RFB_REGNUM
);
816 write_register (RFB_REGNUM
, rfb
- num_bytes
);
817 write_register (RAB_REGNUM
, gr1
);
818 for (i
= 0; i
< num_bytes
; i
+= 4)
820 /* Note: word is in target byte order. */
821 read_register_gen (LR0_REGNUM
+ i
/ 4, (char *) &word
);
822 write_memory (rfb
- num_bytes
+ i
, (char *) &word
, 4);
826 /* There are no arguments in to the dummy frame, so we don't need
827 more than rsize plus the return address and lr1. */
828 write_register (LR0_REGNUM
+ 1, gr1
+ DUMMY_FRAME_RSIZE
+ 2 * 4);
830 /* Set the memory frame pointer. */
831 write_register (LR0_REGNUM
+ DUMMY_FRAME_RSIZE
/ 4 - 1, msp
);
833 /* Allocate arg_slop. */
834 write_register (MSP_REGNUM
, msp
- 16 * 4);
836 /* Save registers. */
837 lrnum
= LR0_REGNUM
+ DUMMY_ARG
/4;
838 for (i
= 0; i
< DUMMY_SAVE_SR128
; ++i
)
839 write_register (lrnum
++, read_register (SR_REGNUM (i
+ 128)));
840 for (i
= 0; i
< DUMMY_SAVE_SR160
; ++i
)
841 write_register (lrnum
++, read_register (SR_REGNUM (i
+ 160)));
842 for (i
= 0; i
< DUMMY_SAVE_GREGS
; ++i
)
843 write_register (lrnum
++, read_register (RETURN_REGNUM
+ i
));
844 /* Save the PCs and LR0. */
845 write_register (lrnum
++, read_register (PC_REGNUM
));
846 write_register (lrnum
++, read_register (NPC_REGNUM
));
847 write_register (lrnum
++, read_register (PC2_REGNUM
));
849 /* Why are we saving LR0? What would clobber it? (the dummy frame should
850 be below it on the register stack, no?). */
851 write_register (lrnum
++, original_lr0
);
857 This routine takes three arguments and makes the cached frames look
858 as if these arguments defined a frame on the cache. This allows the
859 rest of `info frame' to extract the important arguments without much
860 difficulty. Since an individual frame on the 29K is determined by
861 three values (FP, PC, and MSP), we really need all three to do a
865 setup_arbitrary_frame (argc
, argv
)
872 error ("AMD 29k frame specifications require three arguments: rsp pc msp");
874 fid
= create_new_frame (argv
[0], argv
[1]);
877 fatal ("internal: create_new_frame returned invalid frame id");
879 /* Creating a new frame munges the `frame' value from the current
880 GR1, so we restore it again here. FIXME, untangle all this
881 29K frame stuff... */
882 fid
->frame
= argv
[0];
884 /* Our MSP is in argv[2]. It'd be intelligent if we could just
885 save this value in the FRAME. But the way it's set up (FIXME),
886 we must save our caller's MSP. We compute that by adding our
887 memory stack frame size to our MSP. */
888 fid
->saved_msp
= argv
[2] + fid
->msize
;
895 enum a29k_processor_types processor_type
= a29k_unknown
;
898 a29k_get_processor_type ()
900 unsigned int cfg_reg
= (unsigned int) read_register (CFG_REGNUM
);
902 /* Most of these don't have freeze mode. */
903 processor_type
= a29k_no_freeze_mode
;
905 switch ((cfg_reg
>> 28) & 0xf)
908 fprintf_filtered (gdb_stderr
, "Remote debugging an Am29000");
911 fprintf_filtered (gdb_stderr
, "Remote debugging an Am29005");
914 fprintf_filtered (gdb_stderr
, "Remote debugging an Am29050");
915 processor_type
= a29k_freeze_mode
;
918 fprintf_filtered (gdb_stderr
, "Remote debugging an Am29035");
921 fprintf_filtered (gdb_stderr
, "Remote debugging an Am29030");
924 fprintf_filtered (gdb_stderr
, "Remote debugging an Am2920*");
927 fprintf_filtered (gdb_stderr
, "Remote debugging an Am2924*");
930 fprintf_filtered (gdb_stderr
, "Remote debugging an Am29040");
933 fprintf_filtered (gdb_stderr
, "Remote debugging an unknown Am29k\n");
934 /* Don't bother to print the revision. */
937 fprintf_filtered (gdb_stderr
, " revision %c\n", 'A' + ((cfg_reg
>> 24) & 0x0f));
943 extern CORE_ADDR text_end
;
945 /* FIXME, there should be a way to make a CORE_ADDR variable settable. */
947 (add_set_cmd ("rstack_high_address", class_support
, var_uinteger
,
948 (char *)&rstack_high_address
,
949 "Set top address in memory of the register stack.\n\
950 Attempts to access registers saved above this address will be ignored\n\
951 or will produce the value -1.", &setlist
),
954 /* FIXME, there should be a way to make a CORE_ADDR variable settable. */
956 (add_set_cmd ("call_scratch_address", class_support
, var_uinteger
,
958 "Set address in memory where small amounts of RAM can be used\n\
959 when making function calls into the inferior.", &setlist
),