Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb Fetch VFP registers, not FPA.



details:   https://anonhg.NetBSD.org/src/rev/6cfa5f36a5e0
branches:  trunk
changeset: 783110:6cfa5f36a5e0
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Dec 06 06:45:45 2012 +0000

description:
Fetch VFP registers, not FPA.

diffstat:

 external/gpl3/gdb/dist/gdb/armnbsd-nat.c |  79 +++++++++++++++++--------------
 1 files changed, 42 insertions(+), 37 deletions(-)

diffs (188 lines):

diff -r 7ee2056e3d25 -r 6cfa5f36a5e0 external/gpl3/gdb/dist/gdb/armnbsd-nat.c
--- a/external/gpl3/gdb/dist/gdb/armnbsd-nat.c  Thu Dec 06 06:25:24 2012 +0000
+++ b/external/gpl3/gdb/dist/gdb/armnbsd-nat.c  Thu Dec 06 06:45:45 2012 +0000
@@ -123,16 +123,16 @@
 }
 
 static void
-arm_supply_fparegset (struct regcache *regcache, struct fpreg *fparegset)
+arm_supply_vfpregset (struct regcache *regcache, struct fpreg *vfpregset)
 {
   int regno;
 
-  for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
-    regcache_raw_supply (regcache, regno,
-                        (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]);
+  for (regno = 0; regno < 16; regno++)
+    regcache_raw_supply (regcache, regno + ARM_D0_REGNUM,
+                        (char *) vfpregset->fpr_vfp.vfp_regs + 8*regno);
 
-  regcache_raw_supply (regcache, ARM_FPS_REGNUM,
-                      (char *) &fparegset->fpr_fpsr);
+  regcache_raw_supply (regcache, ARM_FPSCR_REGNUM,
+                      (char *) &vfpregset->fpr_vfp.vfp_fpscr);
 }
 
 void
@@ -166,19 +166,22 @@
  }
  
 void
-fill_fpregset (const struct regcache *regcache, fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, fpregset_t *vfpregsetp, int regno)
 {
   if (-1 == regno)
     {
        int regnum;
-       for (regnum = ARM_F0_REGNUM; regnum <= ARM_F7_REGNUM; regnum++)
-         regcache_raw_collect(regcache, regnum, (char *) &fpregsetp->fpr[regnum - ARM_F0_REGNUM]);
+       for (regnum = 0; regnum <= 15; regnum++)
+         regcache_raw_collect(regcache, regnum + ARM_D0_REGNUM,
+                             (char *) vfpregsetp->fpr_vfp.vfp_regs + 8*regnum);
     }
-  else if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
-    regcache_raw_collect(regcache, regno, (char *) &fpregsetp->fpr[regno - ARM_F0_REGNUM]);
+  else if (regno >= ARM_D0_REGNUM && regno <= ARM_D0_REGNUM + 15)
+    regcache_raw_collect(regcache, regno,
+                        (char *) vfpregsetp->fpr_vfp.vfp_regs + 8*regno);
 
-  if (ARM_FPS_REGNUM == regno || -1 == regno)
-    regcache_raw_collect (regcache, ARM_FPS_REGNUM, (char *) &fpregsetp->fpr_fpsr);
+  if (ARM_FPSCR_REGNUM == regno || -1 == regno)
+    regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
+                         (char *) &vfpregsetp->fpr_vfp.vfp_fpscr);
 }
 
 void
@@ -190,7 +193,7 @@
 void
 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
 {
-  arm_supply_fparegset (regcache, (struct fpreg *)fpregsetp);
+  arm_supply_vfpregset (regcache, (struct fpreg *)fpregsetp);
 }
 
 static void
@@ -281,14 +284,14 @@
 
   switch (regno)
     {
-    case ARM_FPS_REGNUM:
-      regcache_raw_supply (regcache, ARM_FPS_REGNUM,
-                          (char *) &inferior_fp_registers.fpr_fpsr);
+    case ARM_FPSCR_REGNUM:
+      regcache_raw_supply (regcache, ARM_FPSCR_REGNUM,
+                          (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr);
       break;
 
     default:
       regcache_raw_supply (regcache, regno,
-                          (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
+                          (char *) inferior_fp_registers.fpr_vfp.vfp_regs + 8 * (regno - ARM_D0_REGNUM));
       break;
     }
 }
@@ -309,7 +312,7 @@
       return;
     }
 
-  arm_supply_fparegset (regcache, &inferior_fp_registers);
+  arm_supply_vfpregset (regcache, &inferior_fp_registers);
 }
 
 static void
@@ -318,10 +321,10 @@
 {
   if (regno >= 0)
     {
-      if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
+      if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
+       fetch_fp_register (regcache, regno);
+      else
        fetch_register (regcache, regno);
-      else
-       fetch_fp_register (regcache, regno);
     }
   else
     {
@@ -473,14 +476,15 @@
 
   switch (regno)
     {
-    case ARM_FPS_REGNUM:
+    case ARM_FPSCR_REGNUM:
       regcache_raw_collect (regcache, ARM_FPS_REGNUM,
-                           (char *) &inferior_fp_registers.fpr_fpsr);
+                           (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr);
       break;
 
     default:
       regcache_raw_collect (regcache, regno,
-                           (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
+                           (char *) inferior_fp_registers.fpr_vfp.vfp_regs
+                           + 8 * (regno - ARM_D0_REGNUM));
       break;
     }
 
@@ -499,12 +503,13 @@
   int regno;
 
 
-  for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
-    regcache_raw_collect (regcache, regno,
-                         (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
+  for (regno = 0; regno <= 15; regno++)
+    regcache_raw_collect (regcache, regno + ARM_D0_REGNUM,
+                         (char *) inferior_fp_registers.fpr_vfp.vfp_regs
+                                  + 8 * regno);
 
-  regcache_raw_collect (regcache, ARM_FPS_REGNUM,
-                       (char *) &inferior_fp_registers.fpr_fpsr);
+  regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
+                       (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr);
 
   ret = ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
                (PTRACE_TYPE_ARG3) &inferior_fp_registers, TIDGET (inferior_ptid));
@@ -519,10 +524,10 @@
 {
   if (regno >= 0)
     {
-      if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
+      if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
+       store_fp_register (regcache, regno);
+      else
        store_register (regcache, regno);
-      else
-       store_fp_register (regcache, regno);
     }
   else
     {
@@ -547,7 +552,7 @@
   CORE_ADDR r_pc;
 
   arm_supply_gregset (regcache, &core_reg->intreg);
-  arm_supply_fparegset (regcache, &core_reg->freg);
+  arm_supply_vfpregset (regcache, &core_reg->freg);
 }
 
 static void
@@ -556,7 +561,7 @@
                         int which, CORE_ADDR ignore)
 {
   struct reg gregset;
-  struct fpreg fparegset;
+  struct fpreg vfpregset;
 
   switch (which)
     {
@@ -579,8 +584,8 @@
        {
          /* The memcpy may be unnecessary, but we can't really be sure
             of the alignment of the data in the core file.  */
-         memcpy (&fparegset, core_reg_sect, sizeof (fparegset));
-         arm_supply_fparegset (regcache, &fparegset);
+         memcpy (&vfpregset, core_reg_sect, sizeof (vfpregset));
+         arm_supply_vfpregset (regcache, &vfpregset);
        }
       break;
 



Home | Main Index | Thread Index | Old Index