示例#1
0
CORE_ADDR
microblaze_frame_chain (struct frame_info * fi)
{
  struct frame_info *dummy;
  CORE_ADDR callers_addr;

  /* Analyze the prologue of this function. */
  if (fi->extra_info->status == 0)
    microblaze_analyze_prologue (fi, 0);

  /* If microblaze_analyze_prologue set NO_MORE_FRAMES, quit now. */
  if (fi->extra_info->status & NO_MORE_FRAMES)
    return 0;

  /* Now that we've analyzed our prologue, we can start to ask
     for information about our caller. The easiest way to do
     this is to analyze our caller's prologue. 

     If our caller has a frame pointer, then we need to find
     the value of that register upon entry to our frame.
     This value is either in fi->saved_regs[rn] if it's saved,
     or it's still in a register.

     If our caller does not have a frame pointer, then his frame base
     is <our base> + -<caller's frame size>. */
  dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), fi->frame);

  if (dummy->extra_info->status & MY_FRAME_IN_FP)
    {
      int fp = dummy->extra_info->fp_regnum;

      /* Our caller has a frame pointer. */
      if (fi->saved_regs[fp] != 0)
	{
	  /* The "FP" was saved on the stack.  Don't forget to adjust
	     the "FP" with the framesize to get a real FP. */
	  callers_addr = microblaze_read_memory_integer (fi->saved_regs[fp]) + dummy->extra_info->framesize;
	}
      else
	{
	  /* It's still in the register.  Don't forget to adjust
	     the "FP" with the framesize to get a real FP. */
  	  callers_addr = read_register (fp) + dummy->extra_info->framesize;
	}
    }
  else
    {
      /* Our caller does not have a frame pointer. */
      callers_addr = fi->frame + dummy->extra_info->framesize;
    }
  return callers_addr;
}
示例#2
0
static CORE_ADDR
mn10300_frame_chain (struct frame_info *fi)
{
  struct frame_info *dummy;
  /* Walk through the prologue to determine the stack size,
     location of saved registers, end of the prologue, etc.  */
  if (fi->extra_info->status == 0)
    mn10300_analyze_prologue (fi, (CORE_ADDR) 0);

  /* Quit now if mn10300_analyze_prologue set NO_MORE_FRAMES.  */
  if (fi->extra_info->status & NO_MORE_FRAMES)
    return 0;

  /* Now that we've analyzed our prologue, determine the frame
     pointer for our caller.

     If our caller has a frame pointer, then we need to
     find the entry value of $a3 to our function.

     If fsr.regs[A3_REGNUM] is nonzero, then it's at the memory
     location pointed to by fsr.regs[A3_REGNUM].

     Else it's still in $a3.

     If our caller does not have a frame pointer, then his
     frame base is fi->frame + -caller's stack size.  */

  /* The easiest way to get that info is to analyze our caller's frame.
     So we set up a dummy frame and call mn10300_analyze_prologue to
     find stuff for us.  */
  dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), fi->frame);

  if (dummy->extra_info->status & MY_FRAME_IN_FP)
    {
      /* Our caller has a frame pointer.  So find the frame in $a3 or
         in the stack.  */
      if (fi->saved_regs[A3_REGNUM])
	return (read_memory_integer (fi->saved_regs[A3_REGNUM], REGISTER_SIZE));
      else
	return read_register (A3_REGNUM);
    }
  else
    {
      int adjust = saved_regs_size (fi);

      /* Our caller does not have a frame pointer.  So his frame starts
         at the base of our frame (fi->frame) + register save space
         + <his size>.  */
      return fi->frame + adjust + -dummy->extra_info->stack_size;
    }
}
示例#3
0
void
microblaze_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
{
  struct frame_info *dummy = analyze_dummy_frame (pc, 0);
  if (dummy->extra_info->status & MY_FRAME_IN_FP)
    {
      *reg = dummy->extra_info->fp_regnum;
      *offset = 0;
    }
  else
    {
      *reg = SP_REGNUM;
      *offset = 0;
    }
}
示例#4
0
static void
mn10300_virtual_frame_pointer (CORE_ADDR pc,
			       int *reg,
			       LONGEST *offset)
{
  struct frame_info *dummy = analyze_dummy_frame (pc, 0);
  /* Set up a dummy frame_info, Analyze the prolog and fill in the
     extra info.  */
  /* Results will tell us which type of frame it uses.  */
  if (dummy->extra_info->status & MY_FRAME_IN_SP)
    {
      *reg = SP_REGNUM;
      *offset = -(dummy->extra_info->stack_size);
    }
  else
    {
      *reg = A3_REGNUM;
      *offset = 0;
    }
}