aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc64-tdep.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2012-11-23 20:30:23 +0000
committerDavid S. Miller <davem@redhat.com>2012-11-23 20:30:23 +0000
commitdb75c7177045ed2551fe9f8a71bb454f6b71cd5f (patch)
tree8962e84e56e4138f9f881acf3a144b5b3712fd49 /gdb/sparc64-tdep.c
parent776fc41826bb3fba1c6ced6c28f54347004a694b (diff)
downloadgdb-db75c7177045ed2551fe9f8a71bb454f6b71cd5f.zip
gdb-db75c7177045ed2551fe9f8a71bb454f6b71cd5f.tar.gz
gdb-db75c7177045ed2551fe9f8a71bb454f6b71cd5f.tar.bz2
Fix Sparc %fsr regset offset for BSD and Linux.
gdb/ * sparc-tdep.h (struct sparc_fpregset): New data structure. (sparc32_sunos4_fpregset, sparc32_bsd_fpregset, sparc32_sol2_fpregset): Declare new globals. (sparc32_supply_fpregset, sparc32_collect_fpregset): Add new 'fpregset' argument. * sparc64-tdep.h (sparc64_supply_fpregset, sparc64_collect_fpregset): Likewise. (sparc64_sol2_fpregset, sparc64_bsd_fpregset): Declare new globals. * sparc-nat.h (struct sparc_fpregset): Add forward declaration. (sparc_fpregset): Declare new global. (sparc_supply_fpregset, sparc_collect_fpregset): Add new 'fpregset' argument. * sparc-linux-nat.c (supply_fpregset): Pass sparc_fpregset down into handler. (fill_fpregset): Likewise. (_initialize_sparc_linux_nat): Set sparc_fpregset to sparc32_bsd_fpregset. * sparc-linux-tdep.c (sparc32_linux_supply_core_fpregset): Pass sparc32_bsd_fpregset down into handler. (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fpregset): Define. (sparc_supply_fpregset): Add 'fpregset' argument. (sparc_collect_fpregset): Likewise. (sparc_fetch_inferior_registers): Pass sparc_fpregset down into fpregset handler. (sparc_store_inferior_registers): Likewise. (_initialize_sparc_nat): Set sparc_fpregset to sparc32_sunos4_fpregset if NULL. * sparc-sol2-nat.c (supply_gregset): Pass sparc_sol2_fpregset down into handler. (fill_fpregset): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_fpregset): Define. * sparc-tdep.c (sparc32_supply_fpregset): Add fpregset arg and use it to compute offsets. (sparc32_collect_fpregset): Likewise. (sparc32_sunos4_fpregset, sparc32_bsd_fpregset): Define. * sparc64-linux-nat.c (supply_fpregset): Pass sparc64_bsd_fpregset down into handler. (fill_fpregset): Likewise. * sparc64-linux-tdep.c (sparc64_linux_supply_core_fpregset): Likewise. (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_fpregset): Define. * sparc64-tdep.c (sparc64_supply_fpregset): Add fpregset arg and use it to compute offsets. (sparc64_collect_fpregset): Likewise. (sparc64_bsd_fpregset): Define. * sparc64fbsd-tdep.c (sparc64fbsd_supply_fpregset): Padd sparc64_bsd_fpregset down into handler. (sparc64fbsd_collect_fpregset): Likewise. * sparc64nbsd-nat.c (sparc64nbsd_supply_fpregset): Add fpregset arg and pass sparc{32,64}_bsd_fpregset down into handler. (sparc64nbsd_collect_fpregset): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_supply_fpregset): Pass sparc64_bsd_fpregset down into handler. * sparc64obsd-tdep.c (sparc64obsd_supply_gregset): Likewise. * sparcnbsd-nat.c (_initialize_sparcnbsd_nat): Set sparc_fpregset to sparc32_bsd_fpregset. * sparcnbsd-tdep.c (sparc32nbsd_supply_gregset): Pass sparc32_bsd_fpregset down into sparc32_supply_fpregset. (sparc32nbsd_supply_fpregset): Likewise.
Diffstat (limited to 'gdb/sparc64-tdep.c')
-rw-r--r--gdb/sparc64-tdep.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 28c9ca4..5dc1eb8 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -1448,7 +1448,8 @@ sparc64_collect_gregset (const struct sparc_gregset *gregset,
}
void
-sparc64_supply_fpregset (struct regcache *regcache,
+sparc64_supply_fpregset (const struct sparc_fpregset *fpregset,
+ struct regcache *regcache,
int regnum, const void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
@@ -1458,14 +1459,15 @@ sparc64_supply_fpregset (struct regcache *regcache,
for (i = 0; i < 32; i++)
{
if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
- regcache_raw_supply (regcache, SPARC_F0_REGNUM + i, regs + (i * 4));
+ regcache_raw_supply (regcache, SPARC_F0_REGNUM + i,
+ regs + fpregset->r_f0_offset + (i * 4));
}
if (sparc32)
{
if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
- regs + (32 * 4) + (16 * 8) + 4);
+ regs + fpregset->r_fsr_offset);
}
else
{
@@ -1473,17 +1475,19 @@ sparc64_supply_fpregset (struct regcache *regcache,
{
if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
regcache_raw_supply (regcache, SPARC64_F32_REGNUM + i,
- regs + (32 * 4) + (i * 8));
+ (regs + fpregset->r_f0_offset
+ + (32 * 4) + (i * 8)));
}
if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
regcache_raw_supply (regcache, SPARC64_FSR_REGNUM,
- regs + (32 * 4) + (16 * 8));
+ regs + fpregset->r_fsr_offset);
}
}
void
-sparc64_collect_fpregset (const struct regcache *regcache,
+sparc64_collect_fpregset (const struct sparc_fpregset *fpregset,
+ const struct regcache *regcache,
int regnum, void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
@@ -1493,14 +1497,15 @@ sparc64_collect_fpregset (const struct regcache *regcache,
for (i = 0; i < 32; i++)
{
if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
- regcache_raw_collect (regcache, SPARC_F0_REGNUM + i, regs + (i * 4));
+ regcache_raw_collect (regcache, SPARC_F0_REGNUM + i,
+ regs + fpregset->r_f0_offset + (i * 4));
}
if (sparc32)
{
if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
- regs + (32 * 4) + (16 * 8) + 4);
+ regs + fpregset->r_fsr_offset);
}
else
{
@@ -1508,12 +1513,18 @@ sparc64_collect_fpregset (const struct regcache *regcache,
{
if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
regcache_raw_collect (regcache, SPARC64_F32_REGNUM + i,
- regs + (32 * 4) + (i * 8));
+ (regs + fpregset->r_f0_offset
+ + (32 * 4) + (i * 8)));
}
if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
regcache_raw_collect (regcache, SPARC64_FSR_REGNUM,
- regs + (32 * 4) + (16 * 8));
+ regs + fpregset->r_fsr_offset);
}
}
+const struct sparc_fpregset sparc64_bsd_fpregset =
+{
+ 0 * 8, /* %f0 */
+ 32 * 8, /* %fsr */
+};