+2015-05-28 Yao Qi <yao.qi@linaro.org>
+
+ * arm-linux-nat.c (arm_linux_vfp_register_count): Remove.
+ (fetch_vfp_regs): Use vfp_register_count from gdbarch_tdep
+ instead of arm_linux_vfp_register_count.
+ (store_vfp_regs): Likewise.
+ (arm_linux_fetch_inferior_registers): Likewise.
+ (arm_linux_store_inferior_registers): Likewise.
+ (arm_linux_read_description): Don't set
+ arm_linux_vfp_register_count.
+ * arm-linux-tdep.c (arm_linux_iterate_over_regset_sections):
+ Adjust.
+ * arm-tdep.c (arm_gdbarch_init): Add assert on
+ vfp_register_count.
+ * arm-tdep.h (struct gdbarch_tdep) <have_vfp_registers>: Rename
+ field to vfp_register_count. All users updated.
+
2015-05-28 Kyle Huey <me@kylehuey.com> (tiny patch)
* gdb/arm-tdep.c (arm_gdbarch_init): Perform arm_abi detection on
/* A flag for whether the WMMX registers are available. */
static int arm_linux_has_wmmx_registers;
-/* The number of 64-bit VFP registers we have (expect this to be 0,
- 16, or 32). */
-static int arm_linux_vfp_register_count;
-
extern int arm_apcs_32;
/* On GNU/Linux, threads are implemented as pseudo-processes, in which
{
char regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
return;
}
- for (regno = 0; regno < arm_linux_vfp_register_count; regno++)
+ for (regno = 0; regno < tdep->vfp_register_count; regno++)
regcache_raw_supply (regcache, regno + ARM_D0_REGNUM,
(char *) regbuf + regno * 8);
{
char regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
return;
}
- for (regno = 0; regno < arm_linux_vfp_register_count; regno++)
+ for (regno = 0; regno < tdep->vfp_register_count; regno++)
regcache_raw_collect (regcache, regno + ARM_D0_REGNUM,
(char *) regbuf + regno * 8);
arm_linux_fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
if (-1 == regno)
{
fetch_regs (regcache);
fetch_fpregs (regcache);
if (arm_linux_has_wmmx_registers)
fetch_wmmx_regs (regcache);
- if (arm_linux_vfp_register_count > 0)
+ if (tdep->vfp_register_count > 0)
fetch_vfp_regs (regcache);
}
else
else if (arm_linux_has_wmmx_registers
&& regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
fetch_wmmx_regs (regcache);
- else if (arm_linux_vfp_register_count > 0
+ else if (tdep->vfp_register_count > 0
&& regno >= ARM_D0_REGNUM
- && regno <= ARM_D0_REGNUM + arm_linux_vfp_register_count)
+ && regno <= ARM_D0_REGNUM + tdep->vfp_register_count)
fetch_vfp_regs (regcache);
}
}
arm_linux_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
if (-1 == regno)
{
store_regs (regcache);
store_fpregs (regcache);
if (arm_linux_has_wmmx_registers)
store_wmmx_regs (regcache);
- if (arm_linux_vfp_register_count > 0)
+ if (tdep->vfp_register_count > 0)
store_vfp_regs (regcache);
}
else
else if (arm_linux_has_wmmx_registers
&& regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
store_wmmx_regs (regcache);
- else if (arm_linux_vfp_register_count > 0
+ else if (tdep->vfp_register_count > 0
&& regno >= ARM_D0_REGNUM
- && regno <= ARM_D0_REGNUM + arm_linux_vfp_register_count)
+ && regno <= ARM_D0_REGNUM + tdep->vfp_register_count)
store_vfp_regs (regcache);
}
}
{
CORE_ADDR arm_hwcap = 0;
arm_linux_has_wmmx_registers = 0;
- arm_linux_vfp_register_count = 0;
if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1)
{
/* NEON implies VFPv3-D32 or no-VFP unit. Say that we only support
Neon with VFPv3-D32. */
if (arm_hwcap & HWCAP_NEON)
- {
- arm_linux_vfp_register_count = 32;
- result = tdesc_arm_with_neon;
- }
+ result = tdesc_arm_with_neon;
else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3)
- {
- arm_linux_vfp_register_count = 32;
- result = tdesc_arm_with_vfpv3;
- }
+ result = tdesc_arm_with_vfpv3;
else
- {
- arm_linux_vfp_register_count = 16;
- result = tdesc_arm_with_vfpv2;
- }
+ result = tdesc_arm_with_vfpv2;
/* Now make sure that the kernel supports reading these
registers. Support was added in 2.6.30. */
enum arm_float_model fp_model = arm_fp_model;
struct tdesc_arch_data *tdesc_data = NULL;
int i, is_m = 0;
- int have_vfp_registers = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0;
+ int vfp_register_count = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0;
int have_neon = 0;
int have_fpa_registers = 1;
const struct target_desc *tdesc = info.target_desc;
if (tdesc_unnumbered_register (feature, "s0") == 0)
have_vfp_pseudos = 1;
- have_vfp_registers = 1;
+ vfp_register_count = i;
/* If we have VFP, also check for NEON. The architecture allows
NEON without VFP (integer vector operations only), but GDB
tdep->fp_model = fp_model;
tdep->is_m = is_m;
tdep->have_fpa_registers = have_fpa_registers;
- tdep->have_vfp_registers = have_vfp_registers;
+ gdb_assert (vfp_register_count == 0
+ || vfp_register_count == 16
+ || vfp_register_count == 32);
+ tdep->vfp_register_count = vfp_register_count;
tdep->have_vfp_pseudos = have_vfp_pseudos;
tdep->have_neon_pseudos = have_neon_pseudos;
tdep->have_neon = have_neon;