* v850-tdep.c (scan_prologue): Changes to deal with scheduled
prologues correctly. First, prologue end is now defined by presence of a branch, jump or call insn. Second, can no longer fix frame offsets because we may not know the offset until after a register has been saved. * (v850_init_extra_frame_info): Fixup frame offsets here because we have all the info at this time. * (v850_frame_chain): Use new calling convention for scan_prologue.
This commit is contained in:
parent
40c0ea5ad6
commit
a638512f44
|
@ -1,3 +1,16 @@
|
||||||
|
start-sanitize-v850
|
||||||
|
Tue Oct 22 16:28:20 1996 Stu Grossman (grossman@critters.cygnus.com)
|
||||||
|
|
||||||
|
* v850-tdep.c (scan_prologue): Changes to deal with scheduled
|
||||||
|
prologues correctly. First, prologue end is now defined by
|
||||||
|
presence of a branch, jump or call insn. Second, can no longer
|
||||||
|
fix frame offsets because we may not know the offset until after a
|
||||||
|
register has been saved.
|
||||||
|
* (v850_init_extra_frame_info): Fixup frame offsets here because
|
||||||
|
we have all the info at this time.
|
||||||
|
* (v850_frame_chain): Use new calling convention for scan_prologue.
|
||||||
|
|
||||||
|
end-sanitize-v850
|
||||||
start-sanitize-d10v
|
start-sanitize-d10v
|
||||||
Tue Oct 22 10:25:29 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
|
Tue Oct 22 10:25:29 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
|
||||||
|
|
||||||
|
@ -25,7 +38,7 @@ Mon Oct 21 14:40:50 1996 Stu Grossman (grossman@critters.cygnus.com)
|
||||||
sign bugs with scanning prologues. Get a little smarter about
|
sign bugs with scanning prologues. Get a little smarter about
|
||||||
calculating the length of uninteresting instructions.
|
calculating the length of uninteresting instructions.
|
||||||
|
|
||||||
start-sanitize-v850
|
end-sanitize-v850
|
||||||
Mon Oct 21 14:01:38 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
|
Mon Oct 21 14:01:38 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
|
||||||
|
|
||||||
* top.c: Add new commands "set annotate" and "show annotate".
|
* top.c: Add new commands "set annotate" and "show annotate".
|
||||||
|
|
|
@ -45,12 +45,19 @@ static CORE_ADDR read_register_dummy PARAMS ((int regno));
|
||||||
|
|
||||||
/* Info gleaned from scanning a function's prologue. */
|
/* Info gleaned from scanning a function's prologue. */
|
||||||
|
|
||||||
|
struct pifsr /* Info about one saved reg */
|
||||||
|
{
|
||||||
|
int framereg; /* Frame reg (SP or FP) */
|
||||||
|
int offset; /* Offset from framereg */
|
||||||
|
int reg; /* Saved register number */
|
||||||
|
};
|
||||||
|
|
||||||
struct prologue_info
|
struct prologue_info
|
||||||
{
|
{
|
||||||
int framereg;
|
int framereg;
|
||||||
int frameoffset;
|
int frameoffset;
|
||||||
int start_function;
|
int start_function;
|
||||||
struct frame_saved_regs *fsr;
|
struct pifsr *pifsrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
static CORE_ADDR scan_prologue PARAMS ((CORE_ADDR pc, struct prologue_info *fs));
|
static CORE_ADDR scan_prologue PARAMS ((CORE_ADDR pc, struct prologue_info *fs));
|
||||||
|
@ -69,6 +76,7 @@ scan_prologue (pc, pi)
|
||||||
struct prologue_info *pi;
|
struct prologue_info *pi;
|
||||||
{
|
{
|
||||||
CORE_ADDR func_addr, prologue_end, current_pc;
|
CORE_ADDR func_addr, prologue_end, current_pc;
|
||||||
|
struct pifsr *pifsr;
|
||||||
int fp_used;
|
int fp_used;
|
||||||
|
|
||||||
/* First, figure out the bounds of the prologue so that we can limit the
|
/* First, figure out the bounds of the prologue so that we can limit the
|
||||||
|
@ -85,10 +93,14 @@ scan_prologue (pc, pi)
|
||||||
else
|
else
|
||||||
pi->start_function = 0;
|
pi->start_function = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (sal.line == 0)
|
if (sal.line == 0)
|
||||||
prologue_end = pc;
|
prologue_end = pc;
|
||||||
else
|
else
|
||||||
prologue_end = sal.end;
|
prologue_end = sal.end;
|
||||||
|
#else
|
||||||
|
prologue_end = pc;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* We're in the boondocks */
|
{ /* We're in the boondocks */
|
||||||
|
@ -105,6 +117,7 @@ scan_prologue (pc, pi)
|
||||||
pi->frameoffset = 0;
|
pi->frameoffset = 0;
|
||||||
pi->framereg = SP_REGNUM;
|
pi->framereg = SP_REGNUM;
|
||||||
fp_used = 0;
|
fp_used = 0;
|
||||||
|
pifsr = pi->pifsrs;
|
||||||
|
|
||||||
for (current_pc = func_addr; current_pc < prologue_end; current_pc += 2)
|
for (current_pc = func_addr; current_pc < prologue_end; current_pc += 2)
|
||||||
{
|
{
|
||||||
|
@ -112,6 +125,10 @@ scan_prologue (pc, pi)
|
||||||
|
|
||||||
insn = read_memory_unsigned_integer (current_pc, 2);
|
insn = read_memory_unsigned_integer (current_pc, 2);
|
||||||
|
|
||||||
|
if ((insn & 0x07c0) == 0x0780 /* jarl or jr */
|
||||||
|
|| (insn & 0xffe0) == 0x0060 /* jmp */
|
||||||
|
|| (insn & 0x0780) == 0x0580) /* branch */
|
||||||
|
break; /* Ran into end of prologue */
|
||||||
if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
|
if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
|
||||||
pi->frameoffset = ((insn & 0x1f) ^ 0x10) - 0x10;
|
pi->frameoffset = ((insn & 0x1f) ^ 0x10) - 0x10;
|
||||||
else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi <imm>,sp,sp */
|
else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi <imm>,sp,sp */
|
||||||
|
@ -124,27 +141,23 @@ scan_prologue (pc, pi)
|
||||||
else if ((insn & 0x07ff) == (0x0760 | SP_REGNUM) /* st.w <reg>,<offset>[sp] */
|
else if ((insn & 0x07ff) == (0x0760 | SP_REGNUM) /* st.w <reg>,<offset>[sp] */
|
||||||
|| (fp_used
|
|| (fp_used
|
||||||
&& (insn & 0x07ff) == (0x0760 | FP_REGNUM))) /* st.w <reg>,<offset>[fp] */
|
&& (insn & 0x07ff) == (0x0760 | FP_REGNUM))) /* st.w <reg>,<offset>[fp] */
|
||||||
if (pi->fsr)
|
if (pifsr)
|
||||||
{
|
{
|
||||||
int framereg;
|
pifsr->framereg = insn & 0x1f;
|
||||||
int reg;
|
pifsr->reg = (insn >> 11) & 0x1f; /* Extract <reg> */
|
||||||
int offset;
|
|
||||||
|
|
||||||
framereg = insn & 0x1f;
|
pifsr->offset = read_memory_integer (current_pc + 2, 2) & ~1;
|
||||||
reg = (insn >> 11) & 0x1f; /* Extract <reg> */
|
|
||||||
|
|
||||||
offset = read_memory_integer (current_pc + 2, 2) & ~1;
|
pifsr++;
|
||||||
|
|
||||||
if (framereg == SP_REGNUM) /* Using SP? */
|
|
||||||
offset += pi->frameoffset; /* Yes, correct for frame size */
|
|
||||||
|
|
||||||
pi->fsr->regs[reg] = offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
|
if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
|
||||||
current_pc += 2;
|
current_pc += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pifsr)
|
||||||
|
pifsr->framereg = 0; /* Tie off last entry */
|
||||||
|
|
||||||
return current_pc;
|
return current_pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +179,7 @@ v850_init_extra_frame_info (fi)
|
||||||
struct frame_info *fi;
|
struct frame_info *fi;
|
||||||
{
|
{
|
||||||
struct prologue_info pi;
|
struct prologue_info pi;
|
||||||
|
struct pifsr pifsrs[NUM_REGS + 1], *pifsr;
|
||||||
int reg;
|
int reg;
|
||||||
|
|
||||||
if (fi->next)
|
if (fi->next)
|
||||||
|
@ -183,16 +197,20 @@ v850_init_extra_frame_info (fi)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pi.fsr = &fi->fsr;
|
pi.pifsrs = pifsrs;
|
||||||
|
|
||||||
scan_prologue (fi->pc, &pi);
|
scan_prologue (fi->pc, &pi);
|
||||||
|
|
||||||
if (!fi->next && pi.framereg == SP_REGNUM)
|
if (!fi->next && pi.framereg == SP_REGNUM)
|
||||||
fi->frame = read_register (pi.framereg) - pi.frameoffset;
|
fi->frame = read_register (pi.framereg) - pi.frameoffset;
|
||||||
|
|
||||||
for (reg = 0; reg < NUM_REGS; reg++)
|
for (pifsr = pifsrs; pifsr->framereg; pifsr++)
|
||||||
if (fi->fsr.regs[reg] != 0)
|
{
|
||||||
fi->fsr.regs[reg] += fi->frame;
|
fi->fsr.regs[pifsr->reg] = pifsr->offset + fi->frame;
|
||||||
|
|
||||||
|
if (pifsr->framereg == SP_REGNUM)
|
||||||
|
fi->fsr.regs[pifsr->reg] += pi.frameoffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the frame prior to FI. Unfortunately, this involves scanning the
|
/* Figure out the frame prior to FI. Unfortunately, this involves scanning the
|
||||||
|
@ -214,7 +232,7 @@ v850_frame_chain (fi)
|
||||||
if (PC_IN_CALL_DUMMY (callers_pc, NULL, NULL))
|
if (PC_IN_CALL_DUMMY (callers_pc, NULL, NULL))
|
||||||
return read_register_dummy (SP_REGNUM); /* XXX Won't work if multiple dummy frames on stack! */
|
return read_register_dummy (SP_REGNUM); /* XXX Won't work if multiple dummy frames on stack! */
|
||||||
|
|
||||||
pi.fsr = NULL;
|
pi.pifsrs = NULL;
|
||||||
|
|
||||||
scan_prologue (callers_pc, &pi);
|
scan_prologue (callers_pc, &pi);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue