示例#1
0
static CORE_ADDR
ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
				  CORE_ADDR lm_addr, CORE_ADDR offset)
{
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
  struct regcache *regcache;
  int tp_offset, tp_regnum;

  regcache = get_thread_arch_regcache (ptid, gdbarch);

  if (tdep->wordsize == 4)
    {
      tp_offset = 0x7008;
      tp_regnum = PPC_R0_REGNUM + 2;
    }
  else
    {
      tp_offset = 0x7010;
      tp_regnum = PPC_R0_REGNUM + 13;
    }
  target_fetch_registers (regcache, tp_regnum);

  ULONGEST tp;
  if (regcache->cooked_read (tp_regnum, &tp) != REG_VALID)
    error (_("Unable to fetch tcb pointer"));

  /* tp points to the end of the TCB block.  The first member of the
     TCB is the pointer to the DTV array.  */
  CORE_ADDR dtv_addr = tp - tp_offset;
  return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
}
示例#2
0
ps_err_e
ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
{
  ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
  struct regcache *regcache
    = get_thread_arch_regcache (ptid, target_gdbarch ());

  supply_gregset (regcache, (const gdb_gregset_t *) gregset);
  target_store_registers (regcache, -1);

  return PS_OK;
}
示例#3
0
ps_err_e
ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
{
  ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
  struct regcache *regcache
    = get_thread_arch_regcache (ptid, target_gdbarch ());

  target_fetch_registers (regcache, -1);
  fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);

  return PS_OK;
}
示例#4
0
ps_err_e
ps_lgetxmmregs (struct ps_prochandle *ph, lwpid_t lwpid, char *xmmregs)
{
  struct cleanup *old_chain;
  struct regcache *regcache;

  old_chain = save_inferior_ptid ();
  inferior_ptid = BUILD_LWP (lwpid, ph->pid);
  regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);

  target_fetch_registers (regcache, -1);
  i387_collect_fxsave (regcache, -1, xmmregs);
  do_cleanups (old_chain);
  return PS_OK;
}
示例#5
0
ps_err_e
ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, prfpregset_t *fpregset)
{
  struct cleanup *old_chain;
  struct regcache *regcache;

  old_chain = save_inferior_ptid ();
  inferior_ptid = BUILD_LWP (lwpid, ph->pid);
  regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);

  target_fetch_registers (regcache, -1);
  fill_fpregset (regcache, fpregset, -1);
  do_cleanups (old_chain);
  return PS_OK;
}
示例#6
0
ps_err_e
ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
{
  struct cleanup *old_chain;
  struct regcache *regcache;

  old_chain = save_inferior_ptid ();
  inferior_ptid = BUILD_LWP (lwpid, ph->pid);
  regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);

  supply_gregset (regcache, gregset);
  target_store_registers (regcache, -1);
  do_cleanups (old_chain);
  return PS_OK;
}
/* If the PPU thread is currently stopped on a spu_run system call,
   return to FD and ADDR the file handle and NPC parameter address
   used with the system call.  Return non-zero if successful.  */
static int
parse_spufs_run (ptid_t ptid, int *fd, CORE_ADDR *addr)
{
  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
  struct gdbarch_tdep *tdep;
  struct regcache *regcache;
  gdb_byte buf[4];
#ifdef ALLOW_UNUSED_VARIABLES
  CORE_ADDR pc;
#endif /* ALLOW_UNUSED_VARIABLES */
  ULONGEST regval;

  /* If we're not on PPU, there's nothing to detect.  */
  if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_powerpc)
    return 0;

  /* Get PPU-side registers.  */
  regcache = get_thread_arch_regcache (ptid, target_gdbarch);
  tdep = new_gdbarch_tdep(target_gdbarch);

  /* Fetch instruction preceding current NIP.  */
  if (target_read_memory (regcache_read_pc (regcache) - 4, buf, 4) != 0)
    return 0;
  /* It should be a "sc" instruction.  */
  if (extract_unsigned_integer_with_byte_order(buf, 4, byte_order) != INSTR_SC)
    return 0;
  /* System call number should be NR_spu_run.  */
  regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum, &regval);
  if (regval != NR_spu_run)
    return 0;

  /* Register 3 contains fd, register 4 the NPC param pointer.  */
  regcache_cooked_read_unsigned (regcache, PPC_ORIG_R3_REGNUM, &regval);
  *fd = (int) regval;
  regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 4, &regval);
  *addr = (CORE_ADDR) regval;
  return 1;
}
示例#8
0
static struct regcache *
get_ps_regcache (struct ps_prochandle *ph, lwpid_t lwpid)
{
  inferior *inf = ph->thread->inf;
  return get_thread_arch_regcache (ptid_t (inf->pid, lwpid), inf->gdbarch);
}