* go32-nat.c (fetch_register): Call i387_supply_fsave instead of
authorMark Kettenis <kettenis@gnu.org>
Sat, 23 Aug 2003 08:56:45 +0000 (08:56 +0000)
committerMark Kettenis <kettenis@gnu.org>
Sat, 23 Aug 2003 08:56:45 +0000 (08:56 +0000)
i387_supply_register.
(go32_fetch_registers): Adjust call to i387_supply_fsave.
* i386nbsd-tdep.c (fetch_core_registers): Adjust call to
i387_supply_fsave.
(fetch_elfcore_registers): Adjust call to i387_supply_fsave and
i387_supply_fxsave.
* i386obsd-tdep.c (fetch_core_registers): Adjust call to
i387_supply_fsave.
* i386bsd-nat.c (supply_fpregset): Adjust call to
i387_supply_fsave.
(fetch_inferior_registers): Remove extraneous whitespace.  Adjust
call to i387_supply_fxsave.  Call i387_supply_fsave instead of
supply_fpregset.
(store_inferior_registers): Remove extraneous whitespace.  Call
i387_fill_fsave instead of fill_fpregset.
* i386gnu-nat.c (fetch_fpregs): Adjust call to i387_supply_fsave.
(supply_fpregset): Likewise.
* i386v4-nat.c (supply_fpregset): Adjust call to
i387_supply_fsave.
* i386-interix-nat.c (supply_fpregset): Adjust call to
i387_supply_fsave.
* i386-linux-nat.c (supply_fpregset): Adjust call to
i387_supply_fsave.
(supply_fpxregset): Adjust call to i387_adjust_fxsave.
* i386-nto-tdep.c (i386nto_supply_fpregset): Adjust calls to
i387supply_fsave and i387_supply_fxsave.
* i387-tdep.c (i387_supply_fsave): Add `regnum' argument.
Incorporate code from `i387_supply_register.
(i387_supply_register): Remove.
(i387_supply_fxsave): Add `regnum' argument.
Update comments.
* i387-tdep.h (i387_supply_fsave, i387_supply_fsxave): Adjust
prototype.
(i387_supply_register): remove prototype.
Update comments.

12 files changed:
gdb/ChangeLog
gdb/go32-nat.c
gdb/i386-interix-nat.c
gdb/i386-linux-nat.c
gdb/i386-nto-tdep.c
gdb/i386bsd-nat.c
gdb/i386gnu-nat.c
gdb/i386nbsd-tdep.c
gdb/i386obsd-tdep.c
gdb/i386v4-nat.c
gdb/i387-tdep.c
gdb/i387-tdep.h

index e20559aa399c66feb0647d9e278fc2f89d5f8205..c99ca61bfe2874239f35d7309b91d616b29883b2 100644 (file)
@@ -1,3 +1,42 @@
+2003-08-23  Mark Kettenis  <kettenis@gnu.org>
+
+       * go32-nat.c (fetch_register): Call i387_supply_fsave instead of
+       i387_supply_register.
+       (go32_fetch_registers): Adjust call to i387_supply_fsave.
+       * i386nbsd-tdep.c (fetch_core_registers): Adjust call to
+       i387_supply_fsave.
+       (fetch_elfcore_registers): Adjust call to i387_supply_fsave and
+       i387_supply_fxsave.
+       * i386obsd-tdep.c (fetch_core_registers): Adjust call to
+       i387_supply_fsave.
+       * i386bsd-nat.c (supply_fpregset): Adjust call to
+       i387_supply_fsave.
+       (fetch_inferior_registers): Remove extraneous whitespace.  Adjust
+       call to i387_supply_fxsave.  Call i387_supply_fsave instead of
+       supply_fpregset.
+       (store_inferior_registers): Remove extraneous whitespace.  Call
+       i387_fill_fsave instead of fill_fpregset.
+       * i386gnu-nat.c (fetch_fpregs): Adjust call to i387_supply_fsave.
+       (supply_fpregset): Likewise.
+       * i386v4-nat.c (supply_fpregset): Adjust call to
+       i387_supply_fsave.
+       * i386-interix-nat.c (supply_fpregset): Adjust call to
+       i387_supply_fsave.
+       * i386-linux-nat.c (supply_fpregset): Adjust call to
+       i387_supply_fsave.
+       (supply_fpxregset): Adjust call to i387_adjust_fxsave.
+       * i386-nto-tdep.c (i386nto_supply_fpregset): Adjust calls to
+       i387supply_fsave and i387_supply_fxsave.
+       * i387-tdep.c (i387_supply_fsave): Add `regnum' argument.
+       Incorporate code from `i387_supply_register.
+       (i387_supply_register): Remove.
+       (i387_supply_fxsave): Add `regnum' argument.
+       Update comments.
+       * i387-tdep.h (i387_supply_fsave, i387_supply_fsxave): Adjust
+       prototype.
+       (i387_supply_register): remove prototype.
+       Update comments.
+       
 2003-08-22  Michael Chastain  <mec@shout.net>
 
        * config/djgpp/fnchange.lst: Remove gdb/testsuite/gdb.c++/*.
index 6ff2710c22d3faf68d46285431936edcd0334940..998927987b372c955641eff3906409f9abf3081a 100644 (file)
@@ -468,7 +468,7 @@ fetch_register (int regno)
   if (regno < FP0_REGNUM)
     supply_register (regno, (char *) &a_tss + regno_mapping[regno].tss_ofs);
   else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
-    i387_supply_register (regno, (char *) &npx);
+    i387_supply_fsave ((const char *) &npx, regno);
   else
     internal_error (__FILE__, __LINE__,
                    "Invalid register no. %d in fetch_register.", regno);
@@ -483,7 +483,7 @@ go32_fetch_registers (int regno)
     {
       for (regno = 0; regno < FP0_REGNUM; regno++)
        fetch_register (regno);
-      i387_supply_fsave ((char *) &npx);
+      i387_supply_fsave ((const char *) &npx, -1);
     }
 }
 
index 9c4daeda42255ce61c9f2853e17d66e17f47a78e..10e4d91c94c522f74632a0a492982e12bad925af 100644 (file)
@@ -80,7 +80,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
 void
 supply_fpregset (fpregset_t *fpregsetp)
 {
-  i387_supply_fsave ((char *) fpregsetp);
+  i387_supply_fsave ((const char *) fpregsetp, -1);
 }
 
 /* Given a pointer to a floating point register set in (fpregset_t *)
index 4549b37ad1d676bfe4828735614d0d25713809c9..4e348d9dc707192a723fe0ba72b0bf8206633169 100644 (file)
@@ -320,7 +320,7 @@ static void store_regs (int tid, int regno) {}
 void 
 supply_fpregset (elf_fpregset_t *fpregsetp)
 {
-  i387_supply_fsave ((char *) fpregsetp);
+  i387_supply_fsave ((const char *) fpregsetp, -1);
   dummy_sse_values ();
 }
 
@@ -385,7 +385,7 @@ static void store_fpregs (int tid, int regno) {}
 void
 supply_fpxregset (elf_fpxregset_t *fpxregsetp)
 {
-  i387_supply_fxsave ((char *) fpxregsetp);
+  i387_supply_fxsave ((const char *) fpxregsetp, -1);
 }
 
 /* Fill register REGNO (if it is a floating-point or SSE register) in
index f9a2887e044779108ab7ccaef26bb69886f94098..2a912a1a6d1945a56ddd78726433a14ccf0e4457 100644 (file)
@@ -87,9 +87,9 @@ static void
 i386nto_supply_fpregset (char *fpregs)
 {
   if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR)
-    i387_supply_fxsave (fpregs);
+    i387_supply_fxsave (fpregs, -1);
   else
-    i387_supply_fsave (fpregs);
+    i387_supply_fsave (fpregs, -1);
 }
 
 static void
index 0fc66fc6ccf46034f9b965154a46e2c12121b7c5..d81dc66005c3488bdbed5c5d4da422a6384f1a4a 100644 (file)
@@ -157,7 +157,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
 void
 supply_fpregset (fpregset_t *fpregsetp)
 {
-  i387_supply_fsave ((char *) fpregsetp);
+  i387_supply_fsave ((const char *) fpregsetp, -1);
 }
 
 /* Fill register REGNO (if it is a floating-point register) in
@@ -176,7 +176,6 @@ fill_fpregset (fpregset_t *fpregsetp, int regno)
 void
 fetch_inferior_registers (int regno)
 {
-
   if (regno == -1 || GETREGS_SUPPLIES (regno))
     {
       gregset_t gregs;
@@ -201,7 +200,7 @@ fetch_inferior_registers (int regno)
                    (PTRACE_ARG3_TYPE) xmmregs, 0) == 0)
        {
          have_ptrace_xmmregs = 1;
-         i387_supply_fxsave (xmmregs);
+         i387_supply_fxsave (xmmregs, -1);
        }
       else
        {
@@ -209,14 +208,14 @@ fetch_inferior_registers (int regno)
                      (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
            perror_with_name ("Couldn't get floating point status");
 
-         supply_fpregset (&fpregs);
+         i387_supply_fsave ((const char *) &fpregs, -1);
        }
 #else
       if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
                  (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
        perror_with_name ("Couldn't get floating point status");
 
-      supply_fpregset (&fpregs);
+      i387_supply_fsave ((const char *) &fpregs, -1);
 #endif
     }
 }
@@ -227,7 +226,6 @@ fetch_inferior_registers (int regno)
 void
 store_inferior_registers (int regno)
 {
-
   if (regno == -1 || GETREGS_SUPPLIES (regno))
     {
       gregset_t gregs;
@@ -272,7 +270,7 @@ store_inferior_registers (int regno)
                      (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
            perror_with_name ("Couldn't get floating point status");
 
-          fill_fpregset (&fpregs, regno);
+          i387_fill_fsave ((char *) &fpregs, regno);
   
           if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
                      (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
index 4623e116cfc8bcdadce51e537c5ada3ce4e843c6..19a0654d76c195f2f7e6b6072acbe500d5fc8f3d 100644 (file)
@@ -89,7 +89,7 @@ fetch_fpregs (struct proc *thread)
     }
 
   /* Supply the floating-point registers.  */
-  i387_supply_fsave (state.hw_state);
+  i387_supply_fsave (state.hw_state, -1);
 }
 
 #ifdef HAVE_SYS_PROCFS_H
@@ -106,7 +106,7 @@ supply_gregset (gdb_gregset_t *gregs)
 void
 supply_fpregset (gdb_fpregset_t *fpregs)
 {
-  i387_supply_fsave ((char *) fpregs);
+  i387_supply_fsave ((const char *) fpregs, -1);
 }
 #endif
 
index 601530bce253cdbf724ebe29ddb741a38db619ed..9e8d973d83167e03e1a2ab79e1aee48bb056c1b9 100644 (file)
@@ -1,4 +1,5 @@
-/* Target-dependent code for NetBSD/i386, for GDB.
+/* Target-dependent code for NetBSD/i386.
+
    Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
@@ -88,7 +89,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
   i386nbsd_supply_reg (regs, -1);
 
   /* Floating point registers.  */
-  i387_supply_fsave (fsave);
+  i387_supply_fsave (fsave, -1);
 }
 
 static void
@@ -106,9 +107,9 @@ fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size,
 
     case 2:  /* Floating point registers.  */
       if (core_reg_size != 108)
-       warning ("Wrong size FP register set in core file."); 
+       warning ("Wrong size FP register set in core file.");
       else
-       i387_supply_fsave (core_reg_sect);  
+       i387_supply_fsave (core_reg_sect, -1);
       break;
 
     case 3:  /* "Extended" floating point registers.  This is gdb-speak
@@ -116,7 +117,7 @@ fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size,
       if (core_reg_size != 512)
        warning ("Wrong size XMM register set in core file.");
       else
-       i387_supply_fxsave (core_reg_sect);
+       i387_supply_fxsave (core_reg_sect, -1);
       break;
 
     default:
index 7db076d3a3e09a4f38644e1788ee472e33919f11..8cfaa2444070c76bfc7ff5b9dda0450c697fe2e2 100644 (file)
@@ -66,7 +66,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
   i386obsd_supply_reg (regs, -1);
 
   /* Floating point registers.  */
-  i387_supply_fsave (fsave);
+  i387_supply_fsave (fsave, -1);
 }
 
 static struct core_fns i386obsd_core_fns =
index 7de8c148034272e83bcbfb888e7d9d76002e6a36..c680dac6b52635243ff90813898fea25d4a055e9 100644 (file)
@@ -139,7 +139,7 @@ supply_fpregset (fpregset_t *fpregsetp)
   if (FP0_REGNUM == 0)
     return;
 
-  i387_supply_fsave ((char *) fpregsetp);
+  i387_supply_fsave ((const char *) fpregsetp, -1);
 }
 
 /* Fill register REGNO (if it is a floating-point register) in
index b6e53a14d620838f9f575831050268a064645171..6feb39285f55b0017c1b5ab52262229c65d7e531 100644 (file)
@@ -361,51 +361,44 @@ static int fsave_offset[] =
 #define FSAVE_ADDR(fsave, regnum) (fsave + fsave_offset[regnum - FP0_REGNUM])
 \f
 
-/* Fill register REGNUM in GDB's register array with the appropriate
+/* Fill register REGNUM in GDB's register cache with the appropriate
    value from *FSAVE.  This function masks off any of the reserved
    bits in *FSAVE.  */
 
 void
-i387_supply_register (int regnum, char *fsave)
-{
-  if (fsave == NULL)
-    {
-      supply_register (regnum, NULL);
-      return;
-    }
-
-  /* Most of the FPU control registers occupy only 16 bits in
-     the fsave area.  Give those a special treatment.  */
-  if (regnum >= FPC_REGNUM
-      && regnum != FIOFF_REGNUM && regnum != FOOFF_REGNUM)
-    {
-      unsigned char val[4];
-
-      memcpy (val, FSAVE_ADDR (fsave, regnum), 2);
-      val[2] = val[3] = 0;
-      if (regnum == FOP_REGNUM)
-       val[1] &= ((1 << 3) - 1);
-      supply_register (regnum, val);
-    }
-  else
-    supply_register (regnum, FSAVE_ADDR (fsave, regnum));
-}
-
-/* Fill GDB's register array with the floating-point register values
-   in *FSAVE.  This function masks off any of the reserved
-   bits in *FSAVE.  */
-
-void
-i387_supply_fsave (char *fsave)
+i387_supply_fsave (const char *fsave, int regnum)
 {
   int i;
 
   for (i = FP0_REGNUM; i < XMM0_REGNUM; i++)
-    i387_supply_register (i, fsave);
+    if (regnum == -1 || regnum == i)
+      {
+       if (fsave == NULL)
+         {
+           supply_register (i, NULL);
+           return;
+         }
+
+       /* Most of the FPU control registers occupy only 16 bits in the
+          fsave area.  Give those a special treatment.  */
+       if (i >= FPC_REGNUM
+           && i != FIOFF_REGNUM && i != FOOFF_REGNUM)
+         {
+           unsigned char val[4];
+
+           memcpy (val, FSAVE_ADDR (fsave, i), 2);
+           val[2] = val[3] = 0;
+           if (i == FOP_REGNUM)
+             val[1] &= ((1 << 3) - 1);
+           supply_register (i, val);
+         }
+       else
+         supply_register (i, FSAVE_ADDR (fsave, i));
+      }
 }
 
 /* Fill register REGNUM (if it is a floating-point register) in *FSAVE
-   with the value in GDB's register array.  If REGNUM is -1, do this
+   with the value in GDB's register cache.  If REGNUM is -1, do this
    for all registers.  This function doesn't touch any of the reserved
    bits in *FSAVE.  */
 
@@ -492,15 +485,15 @@ static int fxsave_offset[] =
   ((regnum == MXCSR_REGNUM) ? (fxsave + 24) : \
    (fxsave + fxsave_offset[regnum - FP0_REGNUM]))
 
-static int i387_tag (unsigned char *raw);
+static int i387_tag (const unsigned char *raw);
 \f
 
-/* Fill GDB's register array with the floating-point and SSE register
-   values in *FXSAVE.  This function masks off any of the reserved
-   bits in *FXSAVE.  */
+/* Fill register REGNUM in GDB's register cache with the appropriate
+   floating-point or SSE register value from *FXSAVE.  This function
+   masks off any of the reserved bits in *FXSAVE.  */
 
 void
-i387_supply_fxsave (char *fxsave)
+i387_supply_fxsave (const char *fxsave, int regnum)
 {
   int i, last_regnum = MXCSR_REGNUM;
 
@@ -508,62 +501,63 @@ i387_supply_fxsave (char *fxsave)
     last_regnum = FOP_REGNUM;
 
   for (i = FP0_REGNUM; i <= last_regnum; i++)
-    {
-      if (fxsave == NULL)
-       {
-         supply_register (i, NULL);
-         continue;
-       }
+    if (regnum == -1 || regnum == i)
+      {
+       if (fxsave == NULL)
+         {
+           supply_register (i, NULL);
+           continue;
+         }
 
-      /* Most of the FPU control registers occupy only 16 bits in
-        the fxsave area.  Give those a special treatment.  */
-      if (i >= FPC_REGNUM && i < XMM0_REGNUM
-         && i != FIOFF_REGNUM && i != FOOFF_REGNUM)
-       {
-         unsigned char val[4];
-
-         memcpy (val, FXSAVE_ADDR (fxsave, i), 2);
-         val[2] = val[3] = 0;
-         if (i == FOP_REGNUM)
-           val[1] &= ((1 << 3) - 1);
-         else if (i== FTAG_REGNUM)
-           {
-             /* The fxsave area contains a simplified version of the
-                 tag word.  We have to look at the actual 80-bit FP
-                 data to recreate the traditional i387 tag word.  */
-
-             unsigned long ftag = 0;
-             int fpreg;
-             int top;
-
-             top = (((FXSAVE_ADDR (fxsave, FSTAT_REGNUM))[1] >> 3) & 0x7);
-
-             for (fpreg = 7; fpreg >= 0; fpreg--)
-               {
-                 int tag;
-
-                 if (val[0] & (1 << fpreg))
-                   {
-                     int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM;
-                     tag = i387_tag (FXSAVE_ADDR (fxsave, regnum));
-                   }
-                 else
-                   tag = 3;            /* Empty */
-
-                 ftag |= tag << (2 * fpreg);
-               }
-             val[0] = ftag & 0xff;
-             val[1] = (ftag >> 8) & 0xff;
-           }
-         supply_register (i, val);
-       }
-      else
-       supply_register (i, FXSAVE_ADDR (fxsave, i));
-    }
+       /* Most of the FPU control registers occupy only 16 bits in
+          the fxsave area.  Give those a special treatment.  */
+       if (i >= FPC_REGNUM && i < XMM0_REGNUM
+           && i != FIOFF_REGNUM && i != FOOFF_REGNUM)
+         {
+           unsigned char val[4];
+
+           memcpy (val, FXSAVE_ADDR (fxsave, i), 2);
+           val[2] = val[3] = 0;
+           if (i == FOP_REGNUM)
+             val[1] &= ((1 << 3) - 1);
+           else if (i== FTAG_REGNUM)
+             {
+               /* The fxsave area contains a simplified version of
+                  the tag word.  We have to look at the actual 80-bit
+                  FP data to recreate the traditional i387 tag word.  */
+
+               unsigned long ftag = 0;
+               int fpreg;
+               int top;
+
+               top = (((FXSAVE_ADDR (fxsave, FSTAT_REGNUM))[1] >> 3) & 0x7);
+
+               for (fpreg = 7; fpreg >= 0; fpreg--)
+                 {
+                   int tag;
+
+                   if (val[0] & (1 << fpreg))
+                     {
+                       int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM;
+                       tag = i387_tag (FXSAVE_ADDR (fxsave, regnum));
+                     }
+                   else
+                     tag = 3;          /* Empty */
+
+                   ftag |= tag << (2 * fpreg);
+                 }
+               val[0] = ftag & 0xff;
+               val[1] = (ftag >> 8) & 0xff;
+             }
+           supply_register (i, val);
+         }
+       else
+         supply_register (i, FXSAVE_ADDR (fxsave, i));
+      }
 }
 
 /* Fill register REGNUM (if it is a floating-point or SSE register) in
-   *FXSAVE with the value in GDB's register array.  If REGNUM is -1, do
+   *FXSAVE with the value in GDB's register cache.  If REGNUM is -1, do
    this for all registers.  This function doesn't touch any of the
    reserved bits in *FXSAVE.  */
 
@@ -624,7 +618,7 @@ i387_fill_fxsave (char *fxsave, int regnum)
    *RAW.  */
 
 static int
-i387_tag (unsigned char *raw)
+i387_tag (const unsigned char *raw)
 {
   int integer;
   unsigned int exponent;
index df5c77bdaecb0f94e9175321f01c0d6d7add5076..84c31ec6108ff1270e7527339f116c9ba935623f 100644 (file)
@@ -45,33 +45,27 @@ extern void i387_register_to_value (struct frame_info *frame, int regnum,
 extern void i387_value_to_register (struct frame_info *frame, int regnum,
                                    struct type *type, const void *from);
 
-/* Fill register REGNUM in GDB's register array with the appropriate
+/* Fill register REGNUM in GDB's register cache with the appropriate
    value from *FSAVE.  This function masks off any of the reserved
    bits in *FSAVE.  */
 
-extern void i387_supply_register (int regnum, char *fsave);
-
-/* Fill GDB's register array with the floating-point register values
-   in *FSAVE.  This function masks off any of the reserved
-   bits in *FSAVE.  */
-
-extern void i387_supply_fsave (char *fsave);
+extern void i387_supply_fsave (const char *fsave, int regnum);
 
 /* Fill register REGNUM (if it is a floating-point register) in *FSAVE
-   with the value in GDB's register array.  If REGNUM is -1, do this
+   with the value in GDB's register cache.  If REGNUM is -1, do this
    for all registers.  This function doesn't touch any of the reserved
    bits in *FSAVE.  */
 
 extern void i387_fill_fsave (char *fsave, int regnum);
 
-/* Fill GDB's register array with the floating-point and SSE register
-   values in *FXSAVE.  This function masks off any of the reserved
-   bits in *FXSAVE.  */
+/* Fill register REGNUM in GDB's register cache with the appropriate
+   floating-point or SSE register value from *FXSAVE.  This function
+   masks off any of the reserved bits in *FXSAVE.  */
 
-extern void i387_supply_fxsave (char *fxsave);
+extern void i387_supply_fxsave (const char *fxsave, int regnum);
 
 /* Fill register REGNUM (if it is a floating-point or SSE register) in
-   *FXSAVE with the value in GDB's register array.  If REGNUM is -1, do
+   *FXSAVE with the value in GDB's register cache.  If REGNUM is -1, do
    this for all registers.  This function doesn't touch any of the
    reserved bits in *FXSAVE.  */
 
This page took 0.055589 seconds and 4 git commands to generate.