PERFORCE change 55217 for review

Peter Wemm peter at FreeBSD.org
Fri Jun 18 03:28:40 GMT 2004


http://perforce.freebsd.org/chv.cgi?CH=55217

Change 55217 by peter at peter_overcee on 2004/06/18 03:27:41

	attempt to fix fpu initial state based on tjr's observations.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/fpu.c#18 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/fpu.c#18 (text+ko) ====

@@ -125,6 +125,8 @@
 	ldmxcsr(mxcsr);
 	fxsave(&fpu_cleanstate);
 	start_emulating();
+	bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp));
+	bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm));
 	fpu_cleanstate_ready = 1;
 	intr_restore(savecrit);
 }
@@ -384,7 +386,6 @@
 {
 	struct pcb *pcb;
 	register_t s;
-	u_short control;
 
 	if (PCPU_GET(fpcurthread) == curthread) {
 		printf("fpudna: fpcurthread == curthread %d times\n",
@@ -409,13 +410,10 @@
 
 	if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
 		/*
-		 * This is the first time this thread has used the FPU or
-		 * the PCB doesn't contain a clean FPU state.  Explicitly
-		 * initialize the FPU and load the default control word.
+		 * This is the first time this thread has used the FPU,
+		 * explicitly load sanitized registers.
 		 */
-		fninit();
-		control = __INITIAL_FPUCW__;
-		fldcw(&control);
+		fxrstor(&fpu_cleanstate);
 		pcb->pcb_flags |= PCB_FPUINITDONE;
 	} else
 		fxrstor(&pcb->pcb_save);


More information about the p4-projects mailing list