2004-05-13 Jim Blandy <jimb@redhat.com>
+ * aix-thread.c (pdc_read_regs, supply_gprs64, supply_fprs)
+ (fetch_regs_user_thread, fetch_regs_kernel_thread)
+ (store_regs_user_thread, store_regs_kernel_thread): Use
+ ppc_num_gprs and ppc_num_fprs instead of '32' and '31'.
+ * ppc-linux-nat.c (fill_gregset): Same.
+ * ppc-linux-tdep.c (ppc_linux_supply_gregset)
+ (ppc_linux_sigtramp_cache): Same.
+ * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_fill_reg)
+ (ppcnbsd_sigtramp_cache_init): Same.
+ * rs6000-nat.c (fetch_core_registers): Same.
+ * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset)
+ (rs6000_frame_cache): Same.
+
* 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.
this is needed, I have implemented what I think it should do,
however this code is untested. */
- uint64_t gprs64[32];
- uint32_t gprs32[32];
- double fprs[32];
+ uint64_t gprs64[ppc_num_gprs];
+ uint32_t gprs32[ppc_num_gprs];
+ double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int regno;
- for (regno = 0; regno < 32; regno++)
+ for (regno = 0; regno < ppc_num_gprs; regno++)
supply_register (tdep->ppc_gp0_regnum + regno, (char *) (vals + regno));
}
floating-point registers. */
gdb_assert (ppc_floating_point_p (current_gdbarch));
- for (regno = 0; regno < 32; regno++)
+ for (regno = 0; regno < ppc_num_fprs; regno++)
supply_register (regno + tdep->ppc_fp0_regnum, (char *) (vals + regno));
}
if (arch64)
supply_gprs64 (ctx.gpr);
else
- for (i = 0; i < 32; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
supply_reg32 (tdep->ppc_gp0_regnum + i, ctx.gpr[i]);
/* Floating-point registers. */
fetch_regs_kernel_thread (int regno, pthdb_tid_t tid)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- uint64_t gprs64[32];
- uint32_t gprs32[32];
- double fprs[32];
+ uint64_t gprs64[ppc_num_gprs];
+ uint32_t gprs32[ppc_num_gprs];
+ double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
int i;
{
if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
- for (i = 0; i < 32; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
supply_reg32 (tdep->ppc_gp0_regnum + i, gprs32[i]);
}
}
/* Collect general-purpose register values from the regcache. */
- for (i = 0; i < 32; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
if (register_cached (tdep->ppc_gp0_regnum + i))
{
if (arch64)
store_regs_kernel_thread (int regno, pthdb_tid_t tid)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- uint64_t gprs64[32];
- uint32_t gprs32[32];
- double fprs[32];
+ uint64_t gprs64[ppc_num_gprs];
+ uint32_t gprs32[ppc_num_gprs];
+ double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
int i;
/* Start with zeros. */
memset (regp, 0, elf_ngreg * sizeof (*regp));
- for (regi = 0; regi < 32; regi++)
+ for (regi = 0; regi < ppc_num_gprs; regi++)
{
if ((regno == -1) || regno == tdep->ppc_gp0_regnum + regi)
right_fill_reg (tdep->ppc_gp0_regnum + regi, (regp + PT_R0 + regi));
struct gdbarch_tdep *regcache_tdep = gdbarch_tdep (regcache_arch);
const bfd_byte *buf = gregs;
- for (regi = 0; regi < 32; regi++)
+ for (regi = 0; regi < ppc_num_gprs; regi++)
right_supply_register (regcache, wordsize,
regcache_tdep->ppc_gp0_regnum + regi,
buf + wordsize * regi);
fpregs = gpregs + 48 * tdep->wordsize;
/* General purpose. */
- for (i = 0; i < 32; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
{
int regnum = i + tdep->ppc_gp0_regnum;
cache->saved_regs[regnum].addr = gpregs + i * tdep->wordsize;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int i;
- for (i = 0; i <= 31; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
{
if (regno == tdep->ppc_gp0_regnum + i || regno == -1)
supply_register (tdep->ppc_gp0_regnum + i,
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int i;
- for (i = 0; i <= 31; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
{
if (regno == tdep->ppc_gp0_regnum + i || regno == -1)
regcache_collect (tdep->ppc_gp0_regnum + i,
base = frame_unwind_register_unsigned (next_frame, SP_REGNUM);
offset = base + 0x18 + 2 * tdep->wordsize;
- for (i = 0; i < 32; i++)
+ for (i = 0; i < ppc_num_gprs; i++)
{
int regnum = i + tdep->ppc_gp0_regnum;
trad_frame_set_reg_addr (this_cache, regnum, offset);
if (ARCH64 ())
{
- for (regi = 0; regi < 32; regi++)
+ for (regi = 0; regi < ppc_num_gprs; 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++)
+ for (regi = 0; regi < ppc_num_fprs; regi++)
supply_register (tdep->ppc_fp0_regnum + regi,
(char *) ®s->r64.fpr[regi]);
}
else
{
- for (regi = 0; regi < 32; regi++)
+ for (regi = 0; regi < ppc_num_gprs; 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++)
+ for (regi = 0; regi < ppc_num_fprs; regi++)
supply_register (tdep->ppc_fp0_regnum + regi,
(char *) ®s->r32.fpr[regi]);
int i;
for (i = tdep->ppc_gp0_regnum, offset = offsets->r0_offset;
- i < tdep->ppc_gp0_regnum + 32;
+ i < tdep->ppc_gp0_regnum + ppc_num_gprs;
i++, offset += 4)
{
if (regnum == -1 || regnum == i)
offset = offsets->r0_offset;
for (i = tdep->ppc_gp0_regnum;
- i < tdep->ppc_gp0_regnum + 32;
+ i < tdep->ppc_gp0_regnum + ppc_num_gprs;
i++, offset += 4)
{
if (regnum == -1 || regnum == i)
then that's strange. But we have no indices to even record
the addresses under, so we just ignore it. */
if (ppc_floating_point_unit_p (gdbarch))
- for (i = fdata.saved_fpr; i < 32; i++)
+ for (i = fdata.saved_fpr; i < ppc_num_fprs; i++)
{
cache->saved_regs[tdep->ppc_fp0_regnum + i].addr = fpr_addr;
fpr_addr += 8;
{
int i;
CORE_ADDR gpr_addr = cache->base + fdata.gpr_offset;
- for (i = fdata.saved_gpr; i < 32; i++)
+ for (i = fdata.saved_gpr; i < ppc_num_gprs; i++)
{
cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = gpr_addr;
gpr_addr += wordsize;
{
int i;
CORE_ADDR ev_addr = cache->base + fdata.ev_offset;
- for (i = fdata.saved_ev; i < 32; i++)
+ for (i = fdata.saved_ev; i < ppc_num_gprs; i++)
{
cache->saved_regs[tdep->ppc_ev0_regnum + i].addr = ev_addr;
cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = ev_addr + 4;