+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
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
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);
/* 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;
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
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. */
/* 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);
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);
}
}
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
/* 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)
#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);
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
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. */
1 * 4, /* %g1 */
16 * 4, /* %l0 */
};
+
+const struct sparc_fpregset sparc32_sol2_fpregset =
+{
+ 0 * 4, /* %f0 */
+ 33 * 4, /* %fsr */
+};
\f
/* The Solaris signal trampolines reside in libc. For normal signals,
}
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;
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;
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);
}
\f
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 */
+};
\f
/* Provide a prototype to silence -Wmissing-prototypes. */
int r_y_size;
};
+struct sparc_fpregset
+{
+ int r_f0_offset;
+ int r_fsr_offset;
+};
+
/* SPARC architecture-specific information. */
struct gdbarch_tdep
/* 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,
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);
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
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. */
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
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. */
16 * 8, /* %l0 */
8 /* sizeof (%y) */
};
+
+const struct sparc_fpregset sparc64_sol2_fpregset =
+{
+ 0 * 8, /* %f0 */
+ 33 * 8, /* %fsr */
+};
\f
static struct sparc_frame_cache *
}
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);
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
{
{
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);
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
{
{
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 */
+};
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);
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 */
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
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);
}
\f
}
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
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. */
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);
}
\f
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);
}
\f
_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 ());
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
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);
}
\f