* config/m88k/tm-m88k.h, m88k-tdep.c: Add call function stuff.
This commit is contained in:
parent
eae7e03cac
commit
abef03ced2
2 changed files with 104 additions and 48 deletions
|
@ -11,7 +11,7 @@ Thu Sep 23 10:49:37 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
z8k-tdep.c: Remove all references to ADDR_BITS_SET.
|
z8k-tdep.c: Remove all references to ADDR_BITS_SET.
|
||||||
* config/m88k/tm-m88k.h: Define TARGET_WRITE_PC.
|
* config/m88k/tm-m88k.h: Define TARGET_WRITE_PC.
|
||||||
|
|
||||||
* config/m88k/tm-m88k.h: Add definitions for calling functions.
|
* config/m88k/tm-m88k.h, m88k-tdep.c: Add call function stuff.
|
||||||
|
|
||||||
Thu Sep 23 00:13:06 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
Thu Sep 23 00:13:06 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||||
|
|
||||||
|
|
148
gdb/m88k-tdep.c
148
gdb/m88k-tdep.c
|
@ -539,7 +539,8 @@ frame_saved_pc (frame)
|
||||||
return read_next_frame_reg(frame, SRP_REGNUM);
|
return read_next_frame_reg(frame, SRP_REGNUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* I believe this is all obsolete call dummy stuff. */
|
||||||
static int
|
static int
|
||||||
pushed_size (prev_words, v)
|
pushed_size (prev_words, v)
|
||||||
int prev_words;
|
int prev_words;
|
||||||
|
@ -744,13 +745,6 @@ push_parameters (return_type, struct_conv, nargs, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
pop_frame ()
|
|
||||||
{
|
|
||||||
error ("Feature not implemented for the m88k yet.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
collect_returned_value (rval, value_type, struct_return, nargs, args)
|
collect_returned_value (rval, value_type, struct_return, nargs, args)
|
||||||
value *rval;
|
value *rval;
|
||||||
|
@ -765,46 +759,108 @@ collect_returned_value (rval, value_type, struct_return, nargs, args)
|
||||||
*rval = value_being_returned (value_type, retbuf, struct_return);
|
*rval = value_being_returned (value_type, retbuf, struct_return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
#if 0
|
/*start of lines added by kev*/
|
||||||
/* Now handled in a machine independent way with CALL_DUMMY_LOCATION. */
|
|
||||||
/* Stuff a breakpoint instruction onto the stack (or elsewhere if the stack
|
|
||||||
is not a good place for it). Return the address at which the instruction
|
|
||||||
got stuffed, or zero if we were unable to stuff it anywhere. */
|
|
||||||
|
|
||||||
CORE_ADDR
|
#define DUMMY_FRAME_SIZE 192
|
||||||
push_breakpoint ()
|
|
||||||
|
static void
|
||||||
|
write_word (sp, word)
|
||||||
|
CORE_ADDR sp;
|
||||||
|
REGISTER_TYPE word;
|
||||||
{
|
{
|
||||||
static char breakpoint_insn[] = BREAKPOINT;
|
register int len = sizeof (REGISTER_TYPE);
|
||||||
extern CORE_ADDR text_end; /* of inferior */
|
char buffer[MAX_REGISTER_RAW_SIZE];
|
||||||
static char readback_buffer[] = BREAKPOINT;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* With a little bit of luck, we can just stash the breakpoint instruction
|
store_unsigned_integer (buffer, len, word);
|
||||||
in the word just beyond the end of normal text space. For systems on
|
write_memory (sp, buffer, len);
|
||||||
which the hardware will not allow us to execute out of the stack segment,
|
}
|
||||||
we have to hope that we *are* at least allowed to effectively extend the
|
|
||||||
text segment by one word. If the actual end of user's the text segment
|
void
|
||||||
happens to fall right at a page boundary this trick may fail. Note that
|
m88k_push_dummy_frame()
|
||||||
we check for this by reading after writing, and comparing in order to
|
{
|
||||||
be sure that the write worked. */
|
register CORE_ADDR sp = read_register (SP_REGNUM);
|
||||||
|
register int rn;
|
||||||
write_memory (text_end, &breakpoint_insn, 4);
|
int offset;
|
||||||
|
|
||||||
/* Fill the readback buffer with some garbage which is certain to be
|
sp -= DUMMY_FRAME_SIZE; /* allocate a bunch of space */
|
||||||
unequal to the breakpoint insn. That way we can tell if the
|
|
||||||
following read doesn't actually succeed. */
|
for (rn = 0, offset = 0; rn <= SP_REGNUM; rn++, offset+=4)
|
||||||
|
write_word (sp+offset, read_register(rn));
|
||||||
for (i = 0; i < sizeof (readback_buffer); i++)
|
|
||||||
readback_buffer[i] = ~ readback_buffer[i]; /* Invert the bits */
|
write_word (sp+offset, read_register (SXIP_REGNUM));
|
||||||
|
offset += 4;
|
||||||
/* Now check that the breakpoint insn was successfully installed. */
|
|
||||||
|
write_word (sp+offset, read_register (SNIP_REGNUM));
|
||||||
read_memory (text_end, readback_buffer, sizeof (readback_buffer));
|
offset += 4;
|
||||||
for (i = 0; i < sizeof (readback_buffer); i++)
|
|
||||||
if (readback_buffer[i] != breakpoint_insn[i])
|
write_word (sp+offset, read_register (SFIP_REGNUM));
|
||||||
return 0; /* Failed to install! */
|
offset += 4;
|
||||||
|
|
||||||
return text_end;
|
write_word (sp+offset, read_register (PSR_REGNUM));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_word (sp+offset, read_register (FPSR_REGNUM));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_word (sp+offset, read_register (FPCR_REGNUM));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_register (SP_REGNUM, sp);
|
||||||
|
write_register (ACTUAL_FP_REGNUM, sp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pop_frame ()
|
||||||
|
{
|
||||||
|
register FRAME frame = get_current_frame ();
|
||||||
|
register CORE_ADDR fp;
|
||||||
|
register int regnum;
|
||||||
|
struct frame_saved_regs fsr;
|
||||||
|
struct frame_info *fi;
|
||||||
|
|
||||||
|
fi = get_frame_info (frame);
|
||||||
|
fp = fi -> frame;
|
||||||
|
get_frame_saved_regs (fi, &fsr);
|
||||||
|
|
||||||
|
if (PC_IN_CALL_DUMMY (read_pc(), read_register(SP_REGNUM), FRAME_FP(fi)))
|
||||||
|
{
|
||||||
|
/* FIXME: I think get_frame_saved_regs should be handling this so
|
||||||
|
that we can deal with the saved registers properly (e.g. frame
|
||||||
|
1 is a call dummy, the user types "frame 2" and then "print $ps"). */
|
||||||
|
register CORE_ADDR sp = read_register (ACTUAL_FP_REGNUM);
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
for (regnum = 0, offset = 0; regnum <= SP_REGNUM; regnum++, offset+=4)
|
||||||
|
(void) write_register (regnum, read_memory_integer (sp+offset, 4));
|
||||||
|
|
||||||
|
write_register (SXIP_REGNUM, read_memory_integer (sp+offset, 4));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_register (SNIP_REGNUM, read_memory_integer (sp+offset, 4));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_register (SFIP_REGNUM, read_memory_integer (sp+offset, 4));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_register (PSR_REGNUM, read_memory_integer (sp+offset, 4));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_register (FPSR_REGNUM, read_memory_integer (sp+offset, 4));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
write_register (FPCR_REGNUM, read_memory_integer (sp+offset, 4));
|
||||||
|
offset += 4;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (regnum = FP_REGNUM ; regnum > 0 ; regnum--)
|
||||||
|
if (fsr.regs[regnum])
|
||||||
|
write_register (regnum,
|
||||||
|
read_memory_integer (fsr.regs[regnum], 4));
|
||||||
|
write_pc(frame_saved_pc(frame));
|
||||||
|
}
|
||||||
|
reinit_frame_cache ();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue