Author: kib
Date: Tue Feb  2 14:16:07 2016
New Revision: 295148
URL: https://svnweb.freebsd.org/changeset/base/295148

Log:
  MFC r294311:
  Clear whole XMM register file instead of only XMM0.  Also clear x87
  registers.  This brings amd64 on par with i386, providing consistent
  initial FPU state.
  
  PR:   206370
  
  MFC r294312:
  Use ANSI definitions.  Wrap long line.
  
  MFC r294313:
  Adjust i386 comment to match amd64 one after r294311.
  
  Approved by:  re (gjb)

Modified:
  stable/10/sys/amd64/amd64/fpu.c
  stable/10/sys/i386/isa/npx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/fpu.c
==============================================================================
--- stable/10/sys/amd64/amd64/fpu.c     Tue Feb  2 11:51:18 2016        
(r295147)
+++ stable/10/sys/amd64/amd64/fpu.c     Tue Feb  2 14:16:07 2016        
(r295148)
@@ -318,13 +318,15 @@ fpuinitstate(void *arg __unused)
                cpu_mxcsr_mask = 0xFFBF;
 
        /*
-        * The fninit instruction does not modify XMM registers.  The
-        * fpusave call dumped the garbage contained in the registers
-        * after reset to the initial state saved.  Clear XMM
-        * registers file image to make the startup program state and
-        * signal handler XMM register content predictable.
+        * The fninit instruction does not modify XMM registers or x87
+        * registers (MM/ST).  The fpusave call dumped the garbage
+        * contained in the registers after reset to the initial state
+        * saved.  Clear XMM and x87 registers file image to make the
+        * startup program state and signal handler XMM/x87 register
+        * content predictable.
         */
-       bzero(&fpu_initialstate->sv_xmm[0], sizeof(struct xmmacc));
+       bzero(fpu_initialstate->sv_fp, sizeof(fpu_initialstate->sv_fp));
+       bzero(fpu_initialstate->sv_xmm, sizeof(fpu_initialstate->sv_xmm));
 
        /*
         * Create a table describing the layout of the CPU Extended
@@ -375,7 +377,7 @@ fpuexit(struct thread *td)
 }
 
 int
-fpuformat()
+fpuformat(void)
 {
 
        return (_MC_FPFMT_XMM);
@@ -661,7 +663,8 @@ fpudna(void)
                 * fpu_initialstate, to ignite the XSAVEOPT
                 * tracking engine.
                 */
-               bcopy(fpu_initialstate, curpcb->pcb_save, 
cpu_max_ext_state_size);
+               bcopy(fpu_initialstate, curpcb->pcb_save,
+                   cpu_max_ext_state_size);
                fpurestore(curpcb->pcb_save);
                if (curpcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
                        fldcw(curpcb->pcb_initial_fpucw);
@@ -676,7 +679,7 @@ fpudna(void)
 }
 
 void
-fpudrop()
+fpudrop(void)
 {
        struct thread *td;
 

Modified: stable/10/sys/i386/isa/npx.c
==============================================================================
--- stable/10/sys/i386/isa/npx.c        Tue Feb  2 11:51:18 2016        
(r295147)
+++ stable/10/sys/i386/isa/npx.c        Tue Feb  2 14:16:07 2016        
(r295148)
@@ -503,11 +503,12 @@ npxinitstate(void *arg __unused)
 
                /*
                 * The fninit instruction does not modify XMM
-                * registers.  The fpusave call dumped the garbage
-                * contained in the registers after reset to the
-                * initial state saved.  Clear XMM registers file
-                * image to make the startup program state and signal
-                * handler XMM register content predictable.
+                * registers or x87 registers (MM/ST).  The fpusave
+                * call dumped the garbage contained in the registers
+                * after reset to the initial state saved.  Clear XMM
+                * and x87 registers file image to make the startup
+                * program state and signal handler XMM/x87 register
+                * content predictable.
                 */
                bzero(npx_initialstate->sv_xmm.sv_fp,
                    sizeof(npx_initialstate->sv_xmm.sv_fp));
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "[email protected]"

Reply via email to