This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfc] [07/14] Prepare i387 targets


Hello,

this patch prepares i387 targets by removing the i387_fill_fsave
and i387_fill_fxsave helper routines (which do not have a REGCACHE
parameter), and replace them by i387_collect_fsave and
i387_collect_fxsave throughout (which do).

Bye,
Ulrich


ChangeLog:

	* i387-tdep.c (i387_fill_fsave, i387_fill_fxsave): Remove.
	* i387-tdep.h (i387_fill_fsave, i387_fill_fxsave): Remove prototypes.
	* i368-linux-nat.c (supply_fpregset, supply_fpxregset): Replace
	i387_fill_fsave and i387_fill_fxsave calls by inline copies.
	* i386-nto-tdep.c (i386nto_regset_fill): Likewise.
	* i386gnu-nat.c (store_fpregs): Likewise.
	* i386v4-nat.c (fill_fpregset): Likewise.
	* go32-nat.c (store_register, go32_store_registers): Likewise.


diff -urNp gdb-orig/gdb/go32-nat.c gdb-head/gdb/go32-nat.c
--- gdb-orig/gdb/go32-nat.c	2007-04-24 18:44:18.672794000 +0200
+++ gdb-head/gdb/go32-nat.c	2007-04-24 19:06:03.016966030 +0200
@@ -497,7 +497,7 @@ store_register (int regno)
     regcache_raw_collect (current_regcache, regno,
 			  (char *) &a_tss + regno_mapping[regno].tss_ofs);
   else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
-    i387_fill_fsave ((char *) &npx, regno);
+    i387_collect_fsave (current_regcache, regno, &npx);
   else
     internal_error (__FILE__, __LINE__,
 		    _("Invalid register no. %d in store_register."), regno);
@@ -514,7 +514,7 @@ go32_store_registers (int regno)
     {
       for (r = 0; r < FP0_REGNUM; r++)
 	store_register (r);
-      i387_fill_fsave ((char *) &npx, -1);
+      i387_collect_fsave (current_regcache, -1, &npx);
     }
 }
 
diff -urNp gdb-orig/gdb/i386gnu-nat.c gdb-head/gdb/i386gnu-nat.c
--- gdb-orig/gdb/i386gnu-nat.c	2007-04-24 18:44:18.722787000 +0200
+++ gdb-head/gdb/i386gnu-nat.c	2007-04-24 19:06:03.021965317 +0200
@@ -186,7 +186,7 @@ store_fpregs (struct proc *thread, int r
 
   /* FIXME: kettenis/2001-07-15: Is this right?  Should we somehow
      take into account DEPRECATED_REGISTER_VALID like the old code did?  */
-  i387_fill_fsave (state.hw_state, regno);
+  i387_collect_fsave (current_regcache, regno, state.hw_state);
 
   err = thread_set_state (thread->port, i386_FLOAT_STATE,
 			  (thread_state_t) &state, i386_FLOAT_STATE_COUNT);
diff -urNp gdb-orig/gdb/i386-linux-nat.c gdb-head/gdb/i386-linux-nat.c
--- gdb-orig/gdb/i386-linux-nat.c	2007-04-24 18:51:21.202819625 +0200
+++ gdb-head/gdb/i386-linux-nat.c	2007-04-24 19:06:03.037963038 +0200
@@ -303,7 +303,7 @@ supply_fpregset (elf_fpregset_t *fpregse
 void
 fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
 {
-  i387_fill_fsave ((char *) fpregsetp, regno);
+  i387_collect_fsave (current_regcache, regno, fpregsetp);
 }
 
 #ifdef HAVE_PTRACE_GETREGS
@@ -367,7 +367,7 @@ supply_fpxregset (elf_fpxregset_t *fpxre
 void
 fill_fpxregset (elf_fpxregset_t *fpxregsetp, int regno)
 {
-  i387_fill_fxsave ((char *) fpxregsetp, regno);
+  i387_collect_fxsave (current_regcache, regno, fpxregsetp);
 }
 
 /* Fetch all registers covered by the PTRACE_GETFPXREGS request from
diff -urNp gdb-orig/gdb/i386-nto-tdep.c gdb-head/gdb/i386-nto-tdep.c
--- gdb-orig/gdb/i386-nto-tdep.c	2007-04-24 18:44:18.718787000 +0200
+++ gdb-head/gdb/i386-nto-tdep.c	2007-04-24 19:06:03.041962468 +0200
@@ -193,9 +193,9 @@ i386nto_regset_fill (int regset, char *d
   else if (regset == NTO_REG_FLOAT)
     {
       if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR)
-	i387_fill_fxsave (data, -1);
+	i387_collect_fxsave (current_regcache, -1, data);
       else
-	i387_fill_fsave (data, -1);
+	i387_collect_fsave (current_regcache, -1, data);
     }
   else
     return -1;
diff -urNp gdb-orig/gdb/i386v4-nat.c gdb-head/gdb/i386v4-nat.c
--- gdb-orig/gdb/i386v4-nat.c	2007-04-24 18:44:18.726786000 +0200
+++ gdb-head/gdb/i386v4-nat.c	2007-04-24 19:06:03.045961898 +0200
@@ -154,7 +154,7 @@ fill_fpregset (fpregset_t *fpregsetp, in
   if (FP0_REGNUM == 0)
     return;
 
-  i387_fill_fsave ((char *) fpregsetp, regno);
+  i387_collect_fsave (current_regcache, regno, fpregsetp);
 }
 
 #endif /* HAVE_FPREGSET_T */
diff -urNp gdb-orig/gdb/i387-tdep.c gdb-head/gdb/i387-tdep.c
--- gdb-orig/gdb/i387-tdep.c	2007-04-24 18:44:18.731785000 +0200
+++ gdb-head/gdb/i387-tdep.c	2007-04-24 19:06:03.050961186 +0200
@@ -473,17 +473,6 @@ i387_collect_fsave (const struct regcach
       }
 #undef I387_ST0_REGNUM
 }
-
-/* Fill register REGNUM (if it is a floating-point register) in *FSAVE
-   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.  */
-
-void
-i387_fill_fsave (void *fsave, int regnum)
-{
-  i387_collect_fsave (current_regcache, regnum, fsave);
-}
 
 
 /* At fxsave_offset[REGNUM] you'll find the offset to the location in
@@ -701,17 +690,6 @@ i387_collect_fxsave (const struct regcac
 #undef I387_NUM_XMM_REGS
 }
 
-/* Fill register REGNUM (if it is a floating-point or SSE register) in
-   *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.  */
-
-void
-i387_fill_fxsave (void *fxsave, int regnum)
-{
-  i387_collect_fxsave (current_regcache, regnum, fxsave);
-}
-
 /* Recreate the FTW (tag word) valid bits from the 80-bit FP data in
    *RAW.  */
 
diff -urNp gdb-orig/gdb/i387-tdep.h gdb-head/gdb/i387-tdep.h
--- gdb-orig/gdb/i387-tdep.h	2007-04-24 18:44:18.736785000 +0200
+++ gdb-head/gdb/i387-tdep.h	2007-04-24 19:06:03.055960473 +0200
@@ -90,13 +90,6 @@ extern void i387_supply_fsave (struct re
 extern void i387_collect_fsave (const struct regcache *regcache, int regnum,
 				void *fsave);
 
-/* Fill register REGNUM (if it is a floating-point register) in *FSAVE
-   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 (void *fsave, int regnum);
-
 /* Fill register REGNUM in REGCACHE with the appropriate
    floating-point or SSE register value from *FXSAVE.  This function
    masks off any of the reserved bits in *FXSAVE.  */
@@ -112,13 +105,6 @@ extern void i387_supply_fxsave (struct r
 extern void i387_collect_fxsave (const struct regcache *regcache, int regnum,
 				 void *fxsave);
 
-/* Fill register REGNUM (if it is a floating-point or SSE register) in
-   *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.  */
-
-extern void i387_fill_fxsave (void *fxsave, int regnum);
-
 /* Prepare the FPU stack in REGCACHE for a function return.  */
 
 extern void i387_return_value (struct gdbarch *gdbarch,
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]