static CORE_ADDR
ppc_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{
  unsigned int insnbuf[POWERPC32_PLT_STUB_LEN];
  struct gdbarch *gdbarch = get_frame_arch (frame);
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
  CORE_ADDR target = 0;

  if (ppc_insns_match_pattern (frame, pc, powerpc32_plt_stub, insnbuf))
    {
      /* Insn pattern is
		lis   r11, xxxx
		lwz   r11, xxxx(r11)
	 Branch target is in r11.  */

      target = (ppc_insn_d_field (insnbuf[0]) << 16)
	| ppc_insn_d_field (insnbuf[1]);
      target = read_memory_unsigned_integer (target, 4, byte_order);
    }

  if (ppc_insns_match_pattern (frame, pc, powerpc32_plt_stub_so, insnbuf))
    {
      /* Insn pattern is
		lwz   r11, xxxx(r30)
	 Branch target is in r11.  */

      target = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 30)
	       + ppc_insn_d_field (insnbuf[0]);
      target = read_memory_unsigned_integer (target, 4, byte_order);
    }

  return target;
}
Beispiel #2
0
static CORE_ADDR
ppc64_standard_linkage4_target (struct frame_info *frame, unsigned int *insn)
{
  CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
		       + ppc_insn_ds_field (insn[2]));

  return ppc64_plt_entry_point (frame, plt_off);
}
Beispiel #3
0
static CORE_ADDR
ppc64_standard_linkage4_target (struct frame_info *frame,
				CORE_ADDR pc, unsigned int *insn)
{
  struct gdbarch *gdbarch = get_frame_arch (frame);
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

  CORE_ADDR plt
    = ((CORE_ADDR) get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 2)
       + (ppc_insn_d_field (insn[1]) << 16)
       + ppc_insn_ds_field (insn[2]));

  return ppc64_plt_entry_point (gdbarch, plt);
}
Beispiel #4
0
static CORE_ADDR
ppc64_standard_linkage2_target (struct frame_info *frame,
				CORE_ADDR pc, unsigned int *insn)
{
  struct gdbarch *gdbarch = get_frame_arch (frame);
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

  /* The address of the PLT entry this linkage function references.  */
  CORE_ADDR plt
    = ((CORE_ADDR) get_frame_register_unsigned (frame,
						tdep->ppc_gp0_regnum + 2)
       + (ppc_insn_d_field (insn[1]) << 16)
       + ppc_insn_ds_field (insn[3]));

  return ppc64_plt_entry_point (gdbarch, plt);
}
Beispiel #5
0
static CORE_ADDR
ppc64_standard_linkage2_target (struct frame_info *frame,
				CORE_ADDR pc, unsigned int *insn)
{
  struct gdbarch *gdbarch = get_frame_arch (frame);
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

  /* The address of the function descriptor this linkage function
     references.  */
  CORE_ADDR desc
    = ((CORE_ADDR) get_frame_register_unsigned (frame,
						tdep->ppc_gp0_regnum + 2)
       + (ppc_insn_d_field (insn[1]) << 16)
       + ppc_insn_ds_field (insn[3]));

  /* The first word of the descriptor is the entry point.  Return that.  */
  return ppc64_desc_entry_point (gdbarch, desc);
}