+2004-05-13 Jim Blandy <jimb@redhat.com>
+
+ * aix-thread.c (supply_gprs64, fetch_regs_user_thread)
+ (store_regs_user_thread): Use tdep->ppc_gp0_regnum, instead
+ of assuming that the gprs are numbered starting with zero.
+ * ppc-linux-nat.c (fill_gregset): Same.
+ * ppc-linux-tdep.c (ppc_linux_supply_gregset): Same.
+ * ppcnbsd-nat.c (getregs_supplies): Same.
+ * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_fill_reg): Same.
+ * rs6000-nat.c (fetch_core_registers): Same.
+ * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset): Same.
+
2004-05-07 Michael Snyder <msnyder@redhat.com>
* tracepoint.c (scope_info): Add handling for LOC_COMPUTED,
static void
supply_gprs64 (uint64_t *vals)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int regno;
for (regno = 0; regno < 32; regno++)
- supply_register (regno, (char *) (vals + regno));
+ supply_register (tdep->ppc_gp0_regnum + regno, (char *) (vals + regno));
}
/* Record that 32-bit register REGNO contains VAL. */
static void
fetch_regs_user_thread (pthdb_pthread_t pdtid)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int status, i;
pthdb_context_t ctx;
supply_gprs64 (ctx.gpr);
else
for (i = 0; i < 32; i++)
- supply_reg32 (i, ctx.gpr[i]);
+ supply_reg32 (tdep->ppc_gp0_regnum + i, ctx.gpr[i]);
/* Floating-point registers. */
if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
for (i = 0; i < 32; i++)
- supply_reg32 (i, gprs32[i]);
+ supply_reg32 (tdep->ppc_gp0_regnum + i, gprs32[i]);
}
}
static void
store_regs_user_thread (pthdb_pthread_t pdtid)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int status, i;
pthdb_context_t ctx;
uint32_t int32;
/* Collect general-purpose register values from the regcache. */
for (i = 0; i < 32; i++)
- if (register_cached (i))
+ if (register_cached (tdep->ppc_gp0_regnum + i))
{
if (arch64)
{
- regcache_collect (i, (void *) &int64);
+ regcache_collect (tdep->ppc_gp0_regnum + i, (void *) &int64);
ctx.gpr[i] = int64;
}
else
{
- regcache_collect (i, (void *) &int32);
+ regcache_collect (tdep->ppc_gp0_regnum + i, (void *) &int32);
ctx.gpr[i] = int32;
}
}
happens, GDB needs to be reconfigured so that longs are 32-bits.) */
unsigned long tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
tmp_fpscr;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
fill_sprs32 (&tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer,
&tmp_fpscr);
for (regi = 0; regi < 32; regi++)
{
- if ((regno == -1) || regno == regi)
- right_fill_reg (regi, (regp + PT_R0 + regi));
+ if ((regno == -1) || regno == tdep->ppc_gp0_regnum + regi)
+ right_fill_reg (tdep->ppc_gp0_regnum + regi, (regp + PT_R0 + regi));
}
if ((regno == -1) || regno == PC_REGNUM)
const bfd_byte *buf = gregs;
for (regi = 0; regi < 32; regi++)
- right_supply_register (regcache, wordsize, regi, buf + wordsize * regi);
+ right_supply_register (regcache, wordsize,
+ regcache_tdep->ppc_gp0_regnum + regi,
+ buf + wordsize * regi);
right_supply_register (regcache, wordsize, gdbarch_pc_regnum (regcache_arch),
buf + wordsize * PPC_LINUX_PT_NIP);
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- return ((regno >= 0 && regno <= 31)
+ return ((regno >= tdep->ppc_gp0_regnum
+ && regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
|| regno == tdep->ppc_lr_regnum
|| regno == tdep->ppc_cr_regnum
|| regno == tdep->ppc_xer_regnum
for (i = 0; i <= 31; i++)
{
- if (regno == i || regno == -1)
- supply_register (i, regs + REG_FIXREG_OFFSET (i));
+ if (regno == tdep->ppc_gp0_regnum + i || regno == -1)
+ supply_register (tdep->ppc_gp0_regnum + i,
+ regs + REG_FIXREG_OFFSET (i));
}
if (regno == tdep->ppc_lr_regnum || regno == -1)
for (i = 0; i <= 31; i++)
{
- if (regno == i || regno == -1)
- regcache_collect (i, regs + REG_FIXREG_OFFSET (i));
+ if (regno == tdep->ppc_gp0_regnum + i || regno == -1)
+ regcache_collect (tdep->ppc_gp0_regnum + i,
+ regs + REG_FIXREG_OFFSET (i));
}
if (regno == tdep->ppc_lr_regnum || regno == -1)
if (ARCH64 ())
{
for (regi = 0; regi < 32; regi++)
- supply_register (regi, (char *) ®s->r64.gpr[regi]);
+ supply_register (tdep->ppc_gp0_regnum + regi,
+ (char *) ®s->r64.gpr[regi]);
if (tdep->ppc_fp0_regnum >= 0)
for (regi = 0; regi < 32; regi++)
else
{
for (regi = 0; regi < 32; regi++)
- supply_register (regi, (char *) ®s->r32.gpr[regi]);
+ supply_register (tdep->ppc_gp0_regnum + regi,
+ (char *) ®s->r32.gpr[regi]);
if (tdep->ppc_fp0_regnum >= 0)
for (regi = 0; regi < 32; regi++)
size_t offset;
int i;
- for (i = 0, offset = offsets->r0_offset; i < 32; i++, offset += 4)
+ for (i = tdep->ppc_gp0_regnum, offset = offsets->r0_offset;
+ i < tdep->ppc_gp0_regnum + 32;
+ i++, offset += 4)
{
if (regnum == -1 || regnum == i)
ppc_supply_reg (regcache, i, gregs, offset);
int i;
offset = offsets->r0_offset;
- for (i = 0; i < 32; i++, offset += 4)
+ for (i = tdep->ppc_gp0_regnum;
+ i < tdep->ppc_gp0_regnum + 32;
+ i++, offset += 4)
{
if (regnum == -1 || regnum == i)
ppc_collect_reg (regcache, i, gregs, offset);