* vax-tdep.c (vax_frame_init_saved_regs): New function.

* config/vax/tm-vax.h (FRAME_FIND_SAVED_REGS): Remove.
(FRAME_INIT_SAVED_REGS): New macro.
This commit is contained in:
Jason Thorpe 2002-04-22 19:44:05 +00:00
parent 7232b100b9
commit ab62c900e2
3 changed files with 42 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2002-04-22 Jason Thorpe <thorpej@wasabisystems.com>
* vax-tdep.c (vax_frame_init_saved_regs): New function.
* config/vax/tm-vax.h (FRAME_FIND_SAVED_REGS): Remove.
(FRAME_INIT_SAVED_REGS): New macro.
2002-04-22 Jason Thorpe <thorpej@wasabisystems.com> 2002-04-22 Jason Thorpe <thorpej@wasabisystems.com>
* MAINTAINERS: Reflect that the Alpha target has been multi-arch'd. * MAINTAINERS: Reflect that the Alpha target has been multi-arch'd.

View File

@ -215,30 +215,8 @@ extern int vax_frame_num_args (struct frame_info *fi);
#define FRAME_ARGS_SKIP 4 #define FRAME_ARGS_SKIP 4
/* Put here the code to store, into a struct frame_saved_regs, #define FRAME_INIT_SAVED_REGS(fi) vax_frame_init_saved_regs ((fi))
the addresses of the saved registers of frame described by FRAME_INFO. extern void vax_frame_init_saved_regs (struct frame_info *);
This includes special registers such as pc and fp saved in special
ways in the stack frame. sp is even more special:
the address we return for it IS the sp for the next frame. */
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
{ register int regnum; \
register int regmask = read_memory_integer ((frame_info)->frame+4, 4) >> 16; \
register CORE_ADDR next_addr; \
memset (&frame_saved_regs, '\0', sizeof frame_saved_regs); \
next_addr = (frame_info)->frame + 16; \
/* Regmask's low bit is for register 0, \
which is the first one that would be pushed. */ \
for (regnum = 0; regnum < 12; regnum++, regmask >>= 1) \
(frame_saved_regs).regs[regnum] = (regmask & 1) ? (next_addr += 4) : 0; \
(frame_saved_regs).regs[SP_REGNUM] = next_addr + 4; \
if (read_memory_integer ((frame_info)->frame + 4, 4) & 0x20000000) \
(frame_saved_regs).regs[SP_REGNUM] += 4 + 4 * read_memory_integer (next_addr + 4, 4); \
(frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 16; \
(frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame + 12; \
(frame_saved_regs).regs[AP_REGNUM] = (frame_info)->frame + 8; \
(frame_saved_regs).regs[PS_REGNUM] = (frame_info)->frame + 4; \
}
/* Things needed for making the inferior call functions. */ /* Things needed for making the inferior call functions. */

View File

@ -93,6 +93,40 @@ vax_register_virtual_type (int regno)
return (builtin_type_int); return (builtin_type_int);
} }
void
vax_frame_init_saved_regs (struct frame_info *frame)
{
int regnum, regmask;
CORE_ADDR next_addr;
if (frame->saved_regs)
return;
frame_saved_regs_zalloc (frame);
regmask = read_memory_integer (frame->frame + 4, 4) >> 16;
next_addr = frame->frame + 16;
/* regmask's low bit is for register 0, which is the first one
what would be pushed. */
for (regnum = 0; regnum < AP_REGNUM; regnum++)
{
if (regmask & (1 << regnum))
frame->saved_regs[regnum] = next_addr += 4;
}
frame->saved_regs[SP_REGNUM] = next_addr + 4;
if (regmask & (1 << FP_REGNUM))
frame->saved_regs[SP_REGNUM] +=
4 + (4 * read_memory_integer (next_addr + 4, 4));
frame->saved_regs[PC_REGNUM] = frame->frame + 16;
frame->saved_regs[FP_REGNUM] = frame->frame + 12;
frame->saved_regs[AP_REGNUM] = frame->frame + 8;
frame->saved_regs[PS_REGNUM] = frame->frame + 4;
}
/* Advance PC across any function entry prologue instructions /* Advance PC across any function entry prologue instructions
to reach some "real" code. */ to reach some "real" code. */