From a56cc1ce222a9c69fd117a8a6f23817f4f1abd5f Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 28 May 2015 10:19:30 +0100 Subject: [PATCH] Remove global variable arm_linux_has_wmmx_registers in arm-linux-nat.c This patch is to remove the global variable arm_linux_has_wmmx_registers in arm-linux-nat.c, and add a new field have_wmmx_registers in 'struct gdbarch_tdep'. gdb: 2015-05-28 Yao Qi * arm-linux-nat.c (arm_linux_has_wmmx_registers): Remove. (arm_linux_fetch_inferior_registers): Use tdep->have_wmmx_registers instead of arm_linux_has_wmmx_registers. (arm_linux_store_inferior_registers): Likewise. (arm_linux_read_description): Don't set arm_linux_has_wmmx_registers. * arm-tdep.c (arm_gdbarch_init): Set tdep->have_wmmx_registers according target descriptions. * arm-tdep.h (struct gdbarch_tdep) : New field. --- gdb/ChangeLog | 13 +++++++++++++ gdb/arm-linux-nat.c | 17 +++++------------ gdb/arm-tdep.c | 4 ++++ gdb/arm-tdep.h | 1 + 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2c404d72b2e..c97e928a889 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2015-05-28 Yao Qi + + * arm-linux-nat.c (arm_linux_has_wmmx_registers): Remove. + (arm_linux_fetch_inferior_registers): Use + tdep->have_wmmx_registers instead of arm_linux_has_wmmx_registers. + (arm_linux_store_inferior_registers): Likewise. + (arm_linux_read_description): Don't set + arm_linux_has_wmmx_registers. + * arm-tdep.c (arm_gdbarch_init): Set + tdep->have_wmmx_registers according target descriptions. + * arm-tdep.h (struct gdbarch_tdep) : New + field. + 2015-05-28 Yao Qi * arm-linux-nat.c (arm_linux_vfp_register_count): Remove. diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 5c0ede60ad1..7352841f593 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -61,9 +61,6 @@ #define PTRACE_SETHBPREGS 30 #endif -/* A flag for whether the WMMX registers are available. */ -static int arm_linux_has_wmmx_registers; - extern int arm_apcs_32; /* On GNU/Linux, threads are implemented as pseudo-processes, in which @@ -526,7 +523,7 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, { fetch_regs (regcache); fetch_fpregs (regcache); - if (arm_linux_has_wmmx_registers) + if (tdep->have_wmmx_registers) fetch_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) fetch_vfp_regs (regcache); @@ -537,7 +534,7 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, fetch_register (regcache, regno); else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM) fetch_fpregister (regcache, regno); - else if (arm_linux_has_wmmx_registers + else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM) fetch_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 @@ -562,7 +559,7 @@ arm_linux_store_inferior_registers (struct target_ops *ops, { store_regs (regcache); store_fpregs (regcache); - if (arm_linux_has_wmmx_registers) + if (tdep->have_wmmx_registers) store_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) store_vfp_regs (regcache); @@ -573,7 +570,7 @@ arm_linux_store_inferior_registers (struct target_ops *ops, store_register (regcache, regno); else if ((regno >= ARM_F0_REGNUM) && (regno <= ARM_FPS_REGNUM)) store_fpregister (regcache, regno); - else if (arm_linux_has_wmmx_registers + else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM) store_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 @@ -636,7 +633,6 @@ static const struct target_desc * arm_linux_read_description (struct target_ops *ops) { CORE_ADDR arm_hwcap = 0; - arm_linux_has_wmmx_registers = 0; if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1) { @@ -644,10 +640,7 @@ arm_linux_read_description (struct target_ops *ops) } if (arm_hwcap & HWCAP_IWMMXT) - { - arm_linux_has_wmmx_registers = 1; - return tdesc_arm_with_iwmmxt; - } + return tdesc_arm_with_iwmmxt; if (arm_hwcap & HWCAP_VFP) { diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 4011de8c9ac..c99f2a97d29 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9915,6 +9915,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) struct tdesc_arch_data *tdesc_data = NULL; int i, is_m = 0; int vfp_register_count = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0; + int have_wmmx_registers = 0; int have_neon = 0; int have_fpa_registers = 1; const struct target_desc *tdesc = info.target_desc; @@ -10178,6 +10179,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdesc_data_cleanup (tdesc_data); return NULL; } + + have_wmmx_registers = 1; } /* If we have a VFP unit, check whether the single precision registers @@ -10289,6 +10292,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->fp_model = fp_model; tdep->is_m = is_m; tdep->have_fpa_registers = have_fpa_registers; + tdep->have_wmmx_registers = have_wmmx_registers; gdb_assert (vfp_register_count == 0 || vfp_register_count == 16 || vfp_register_count == 32); diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index 06658a00e85..f81679a201c 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -161,6 +161,7 @@ struct gdbarch_tdep enum arm_float_model fp_model; /* Floating point calling conventions. */ int have_fpa_registers; /* Does the target report the FPA registers? */ + int have_wmmx_registers; /* Does the target report the WMMX registers? */ /* The number of VFP registers reported by the target. It is zero if VFP registers are not supported. */ int vfp_register_count; -- 2.30.2