Remove global variable arm_linux_has_wmmx_registers in arm-linux-nat.c
authorYao Qi <yao.qi@linaro.org>
Thu, 28 May 2015 09:19:30 +0000 (10:19 +0100)
committerYao Qi <yao.qi@linaro.org>
Thu, 28 May 2015 09:19:30 +0000 (10:19 +0100)
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  <yao.qi@linaro.org>

* 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) <have_wmmx_registers>: New
field.

gdb/ChangeLog
gdb/arm-linux-nat.c
gdb/arm-tdep.c
gdb/arm-tdep.h

index 2c404d7..c97e928 100644 (file)
@@ -1,5 +1,18 @@
 2015-05-28  Yao Qi  <yao.qi@linaro.org>
 
+       * 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) <have_wmmx_registers>: New
+       field.
+
+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.
index 5c0ede6..7352841 100644 (file)
@@ -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)
     {
index 4011de8..c99f2a9 100644 (file)
@@ -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);
index 06658a0..f81679a 100644 (file)
@@ -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;