aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--gdb/ChangeLog65
-rw-r--r--gdb/sparc-linux-nat.c6
-rw-r--r--gdb/sparc-linux-tdep.c4
-rw-r--r--gdb/sparc-nat.c13
-rw-r--r--gdb/sparc-nat.h8
-rw-r--r--gdb/sparc-sol2-nat.c4
-rw-r--r--gdb/sparc-sol2-tdep.c6
-rw-r--r--gdb/sparc-tdep.c30
-rw-r--r--gdb/sparc-tdep.h15
-rw-r--r--gdb/sparc64-linux-nat.c4
-rw-r--r--gdb/sparc64-linux-tdep.c4
-rw-r--r--gdb/sparc64-sol2-tdep.c6
-rw-r--r--gdb/sparc64-tdep.c31
-rw-r--r--gdb/sparc64-tdep.h9
-rw-r--r--gdb/sparc64fbsd-tdep.c4
-rw-r--r--gdb/sparc64nbsd-nat.c11
-rw-r--r--gdb/sparc64nbsd-tdep.c2
-rw-r--r--gdb/sparc64obsd-tdep.c2
-rw-r--r--gdb/sparcnbsd-nat.c1
-rw-r--r--gdb/sparcnbsd-tdep.c5
20 files changed, 183 insertions, 47 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f567d47..50b96e6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,68 @@
+2012-11-23 David S. Miller <davem@davemloft.net>
+
+ * 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.
+
2012-11-21 Tom Tromey <tromey@redhat.com>
* gdbtypes.h (struct cplus_struct_type) <localtype_ptr>: Remove
diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c
index d56a6bd..4589b95 100644
--- a/gdb/sparc-linux-nat.c
+++ b/gdb/sparc-linux-nat.c
@@ -37,7 +37,7 @@ supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
void
supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc32_supply_fpregset (regcache, -1, fpregs);
+ sparc32_supply_fpregset (sparc_fpregset, regcache, -1, fpregs);
}
void
@@ -50,7 +50,7 @@ void
fill_fpregset (const struct regcache *regcache,
prfpregset_t *fpregs, int regnum)
{
- sparc32_collect_fpregset (regcache, regnum, fpregs);
+ sparc32_collect_fpregset (sparc_fpregset, regcache, regnum, fpregs);
}
void _initialize_sparc_linux_nat (void);
@@ -63,6 +63,8 @@ _initialize_sparc_linux_nat (void)
/* Fill in the generic GNU/Linux methods. */
t = linux_target ();
+ sparc_fpregset = &sparc32_bsd_fpregset;
+
/* Add our register access methods. */
t->to_fetch_registers = sparc_fetch_inferior_registers;
t->to_store_registers = sparc_store_inferior_registers;
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 63c12e3..1c369f6 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -210,7 +210,7 @@ sparc32_linux_supply_core_fpregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- sparc32_supply_fpregset (regcache, regnum, fpregs);
+ sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
}
static void
@@ -218,7 +218,7 @@ sparc32_linux_collect_core_fpregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *fpregs, size_t len)
{
- sparc32_collect_fpregset (regcache, regnum, fpregs);
+ sparc32_collect_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
}
/* Set the program counter for process PTID to PC. */
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index cf36abd..c0007fe 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -82,12 +82,15 @@ typedef struct fp_status fpregset_t;
/* Register set description. */
const struct sparc_gregset *sparc_gregset;
+const struct sparc_fpregset *sparc_fpregset;
void (*sparc_supply_gregset) (const struct sparc_gregset *,
struct regcache *, int , const void *);
void (*sparc_collect_gregset) (const struct sparc_gregset *,
const struct regcache *, int, void *);
-void (*sparc_supply_fpregset) (struct regcache *, int , const void *);
-void (*sparc_collect_fpregset) (const struct regcache *, int , void *);
+void (*sparc_supply_fpregset) (const struct sparc_fpregset *,
+ struct regcache *, int , const void *);
+void (*sparc_collect_fpregset) (const struct sparc_fpregset *,
+ const struct regcache *, int , void *);
int (*sparc_gregset_supplies_p) (struct gdbarch *, int);
int (*sparc_fpregset_supplies_p) (struct gdbarch *, int);
@@ -183,7 +186,7 @@ sparc_fetch_inferior_registers (struct target_ops *ops,
if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- sparc_supply_fpregset (regcache, -1, &fpregs);
+ sparc_supply_fpregset (sparc_fpregset, regcache, -1, &fpregs);
}
}
@@ -234,7 +237,7 @@ sparc_store_inferior_registers (struct target_ops *ops,
perror_with_name (_("Couldn't get floating-point registers"));
memcpy (&saved_fpregs, &fpregs, sizeof (fpregs));
- sparc_collect_fpregset (regcache, regnum, &fpregs);
+ sparc_collect_fpregset (sparc_fpregset, regcache, regnum, &fpregs);
/* Writing the floating-point registers will fail on NetBSD with
EINVAL if the inferior process doesn't have an FPU state
@@ -353,6 +356,8 @@ _initialize_sparc_nat (void)
/* Deafult to using SunOS 4 register sets. */
if (sparc_gregset == NULL)
sparc_gregset = &sparc32_sunos4_gregset;
+ if (sparc_fpregset == NULL)
+ sparc_fpregset = &sparc32_sunos4_fpregset;
if (sparc_supply_gregset == NULL)
sparc_supply_gregset = sparc32_supply_gregset;
if (sparc_collect_gregset == NULL)
diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h
index 41c1d72..60b4ce1 100644
--- a/gdb/sparc-nat.h
+++ b/gdb/sparc-nat.h
@@ -21,14 +21,18 @@
#define SPARC_NAT_H 1
struct sparc_gregset;
+struct sparc_fpregset;
extern const struct sparc_gregset *sparc_gregset;
+extern const struct sparc_fpregset *sparc_fpregset;
extern void (*sparc_supply_gregset) (const struct sparc_gregset *,
struct regcache *, int , const void *);
extern void (*sparc_collect_gregset) (const struct sparc_gregset *,
const struct regcache *, int, void *);
-extern void (*sparc_supply_fpregset) (struct regcache *, int , const void *);
-extern void (*sparc_collect_fpregset) (const struct regcache *, int , void *);
+extern void (*sparc_supply_fpregset) (const struct sparc_fpregset *,
+ struct regcache *, int , const void *);
+extern void (*sparc_collect_fpregset) (const struct sparc_fpregset *,
+ const struct regcache *, int , void *);
extern int (*sparc_gregset_supplies_p) (struct gdbarch *gdbarch, int);
extern int (*sparc_fpregset_supplies_p) (struct gdbarch *gdbarch, int);
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index 24e2602..1972383 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -82,7 +82,7 @@ supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
void
supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc_supply_fpregset (regcache, -1, fpregs);
+ sparc_supply_fpregset (sparc_sol2_fpregset, regcache, -1, fpregs);
}
void
@@ -95,7 +95,7 @@ void
fill_fpregset (const struct regcache *regcache,
prfpregset_t *fpregs, int regnum)
{
- sparc_collect_fpregset (regcache, regnum, fpregs);
+ sparc_collect_fpregset (sparc_sol2_fpregset, regcache, regnum, fpregs);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index d2fc4d6..ca1077d 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -47,6 +47,12 @@ const struct sparc_gregset sparc32_sol2_gregset =
1 * 4, /* %g1 */
16 * 4, /* %l0 */
};
+
+const struct sparc_fpregset sparc32_sol2_fpregset =
+{
+ 0 * 4, /* %f0 */
+ 33 * 4, /* %fsr */
+};
/* The Solaris signal trampolines reside in libc. For normal signals,
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 6da2297..3164ed3 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1953,7 +1953,8 @@ sparc32_collect_gregset (const struct sparc_gregset *gregset,
}
void
-sparc32_supply_fpregset (struct regcache *regcache,
+sparc32_supply_fpregset (const struct sparc_fpregset *fpregset,
+ struct regcache *regcache,
int regnum, const void *fpregs)
{
const gdb_byte *regs = fpregs;
@@ -1962,15 +1963,18 @@ sparc32_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 (regnum == SPARC32_FSR_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC32_FSR_REGNUM, regs + (32 * 4) + 4);
+ regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
+ regs + fpregset->r_fsr_offset);
}
void
-sparc32_collect_fpregset (const struct regcache *regcache,
+sparc32_collect_fpregset (const struct sparc_fpregset *fpregset,
+ const struct regcache *regcache,
int regnum, void *fpregs)
{
gdb_byte *regs = fpregs;
@@ -1979,11 +1983,13 @@ sparc32_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 (regnum == SPARC32_FSR_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SPARC32_FSR_REGNUM, regs + (32 * 4) + 4);
+ regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
+ regs + fpregset->r_fsr_offset);
}
@@ -2001,6 +2007,18 @@ const struct sparc_gregset sparc32_sunos4_gregset =
4 * 4, /* %g1 */
-1 /* %l0 */
};
+
+const struct sparc_fpregset sparc32_sunos4_fpregset =
+{
+ 0 * 4, /* %f0 */
+ 33 * 4, /* %fsr */
+};
+
+const struct sparc_fpregset sparc32_bsd_fpregset =
+{
+ 0 * 4, /* %f0 */
+ 32 * 4, /* %fsr */
+};
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index db94994..64b6066 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -41,6 +41,12 @@ struct sparc_gregset
int r_y_size;
};
+struct sparc_fpregset
+{
+ int r_f0_offset;
+ int r_fsr_offset;
+};
+
/* SPARC architecture-specific information. */
struct gdbarch_tdep
@@ -198,6 +204,8 @@ extern void sparc_collect_rwindow (const struct regcache *regcache,
/* Register offsets for SunOS 4. */
extern const struct sparc_gregset sparc32_sunos4_gregset;
+extern const struct sparc_fpregset sparc32_sunos4_fpregset;
+extern const struct sparc_fpregset sparc32_bsd_fpregset;
extern void sparc32_supply_gregset (const struct sparc_gregset *gregset,
struct regcache *regcache,
@@ -205,15 +213,18 @@ extern void sparc32_supply_gregset (const struct sparc_gregset *gregset,
extern void sparc32_collect_gregset (const struct sparc_gregset *gregset,
const struct regcache *regcache,
int regnum, void *gregs);
-extern void sparc32_supply_fpregset (struct regcache *regcache,
+extern void sparc32_supply_fpregset (const struct sparc_fpregset *fpregset,
+ struct regcache *regcache,
int regnum, const void *fpregs);
-extern void sparc32_collect_fpregset (const struct regcache *regcache,
+extern void sparc32_collect_fpregset (const struct sparc_fpregset *fpregset,
+ const struct regcache *regcache,
int regnum, void *fpregs);
/* Functions and variables exported from sparc-sol2-tdep.c. */
/* Register offsets for Solaris 2. */
extern const struct sparc_gregset sparc32_sol2_gregset;
+extern const struct sparc_fpregset sparc32_sol2_fpregset;
extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name);
diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c
index 1fec42a..d21728f 100644
--- a/gdb/sparc64-linux-nat.c
+++ b/gdb/sparc64-linux-nat.c
@@ -53,7 +53,7 @@ supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
void
supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc64_supply_fpregset (regcache, -1, fpregs);
+ sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, -1, fpregs);
}
void
@@ -66,7 +66,7 @@ void
fill_fpregset (const struct regcache *regcache,
prfpregset_t *fpregs, int regnum)
{
- sparc64_collect_fpregset (regcache, regnum, fpregs);
+ sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 019af2b..0dd9103 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -174,7 +174,7 @@ sparc64_linux_supply_core_fpregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- sparc64_supply_fpregset (regcache, regnum, fpregs);
+ sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
static void
@@ -182,7 +182,7 @@ sparc64_linux_collect_core_fpregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *fpregs, size_t len)
{
- sparc64_collect_fpregset (regcache, regnum, fpregs);
+ sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
/* Set the program counter for process PTID to PC. */
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index 35431b0..cb1e4be 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -45,6 +45,12 @@ const struct sparc_gregset sparc64_sol2_gregset =
16 * 8, /* %l0 */
8 /* sizeof (%y) */
};
+
+const struct sparc_fpregset sparc64_sol2_fpregset =
+{
+ 0 * 8, /* %f0 */
+ 33 * 8, /* %fsr */
+};
static struct sparc_frame_cache *
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 */
+};
diff --git a/gdb/sparc64-tdep.h b/gdb/sparc64-tdep.h
index a355e48..e59bf8d 100644
--- a/gdb/sparc64-tdep.h
+++ b/gdb/sparc64-tdep.h
@@ -103,15 +103,18 @@ extern void sparc64_supply_gregset (const struct sparc_gregset *gregset,
extern void sparc64_collect_gregset (const struct sparc_gregset *gregset,
const struct regcache *regcache,
int regnum, void *gregs);
-extern void sparc64_supply_fpregset (struct regcache *regcache,
+extern void sparc64_supply_fpregset (const struct sparc_fpregset *fpregset,
+ struct regcache *regcache,
int regnum, const void *fpregs);
-extern void sparc64_collect_fpregset (const struct regcache *regcache,
+extern void sparc64_collect_fpregset (const struct sparc_fpregset *fpregset,
+ const struct regcache *regcache,
int regnum, void *fpregs);
/* Functions and variables exported from sparc64-sol2-tdep.c. */
/* Register offsets for Solaris 2. */
extern const struct sparc_gregset sparc64_sol2_gregset;
+extern const struct sparc_fpregset sparc64_sol2_fpregset;
extern void sparc64_sol2_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
@@ -130,4 +133,6 @@ extern struct trad_frame_saved_reg *
sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
struct frame_info *next_frame);
+extern const struct sparc_fpregset sparc64_bsd_fpregset;
+
#endif /* sparc64-tdep.h */
diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c
index f58e73b..77fc4e3 100644
--- a/gdb/sparc64fbsd-tdep.c
+++ b/gdb/sparc64fbsd-tdep.c
@@ -69,7 +69,7 @@ sparc64fbsd_supply_fpregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- sparc64_supply_fpregset (regcache, regnum, fpregs);
+ sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
static void
@@ -77,7 +77,7 @@ sparc64fbsd_collect_fpregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *fpregs, size_t len)
{
- sparc64_collect_fpregset (regcache, regnum, fpregs);
+ sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c
index b37965c..a1567c5 100644
--- a/gdb/sparc64nbsd-nat.c
+++ b/gdb/sparc64nbsd-nat.c
@@ -56,15 +56,16 @@ sparc64nbsd_collect_gregset (const struct sparc_gregset *gregset,
}
static void
-sparc64nbsd_supply_fpregset (struct regcache *regcache,
+sparc64nbsd_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);
if (sparc32)
- sparc32_supply_fpregset (regcache, regnum, fpregs);
+ sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
else
- sparc64_supply_fpregset (regcache, regnum, fpregs);
+ sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
static void
@@ -74,9 +75,9 @@ sparc64nbsd_collect_fpregset (const struct regcache *regcache,
int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
if (sparc32)
- sparc32_collect_fpregset (regcache, regnum, fpregs);
+ sparc32_collect_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
else
- sparc64_collect_fpregset (regcache, regnum, fpregs);
+ sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
/* Determine whether `gregset_t' contains register REGNUM. */
diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c
index 273fb26..a6c22c1 100644
--- a/gdb/sparc64nbsd-tdep.c
+++ b/gdb/sparc64nbsd-tdep.c
@@ -64,7 +64,7 @@ sparc64nbsd_supply_fpregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- sparc64_supply_fpregset (regcache, regnum, fpregs);
+ sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
}
diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c
index 6148eab..0cd83e1 100644
--- a/gdb/sparc64obsd-tdep.c
+++ b/gdb/sparc64obsd-tdep.c
@@ -64,7 +64,7 @@ sparc64obsd_supply_gregset (const struct regset *regset,
const char *regs = gregs;
sparc64_supply_gregset (&sparc64obsd_core_gregset, regcache, regnum, regs);
- sparc64_supply_fpregset (regcache, regnum, regs + 288);
+ sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, regs + 288);
}
diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c
index 847419f..b78f50a 100644
--- a/gdb/sparcnbsd-nat.c
+++ b/gdb/sparcnbsd-nat.c
@@ -63,6 +63,7 @@ void
_initialize_sparcnbsd_nat (void)
{
sparc_gregset = &sparc32nbsd_gregset;
+ sparc_fpregset = &sparc32_bsd_fpregset;
/* We've got nothing to add to the generic SPARC target. */
add_target (sparc_target ());
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index 9afbbcf..84e7395 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -64,7 +64,8 @@ sparc32nbsd_supply_gregset (const struct regset *regset,
Instead, the general-purpose and floating-point registers are
lumped together in a single section. */
if (len >= 212)
- sparc32_supply_fpregset (regcache, regnum, (const char *) gregs + 80);
+ sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum,
+ (const char *) gregs + 80);
}
static void
@@ -72,7 +73,7 @@ sparc32nbsd_supply_fpregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
- sparc32_supply_fpregset (regcache, regnum, fpregs);
+ sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
}