svn commit: r187867 - in head/sys/amd64: amd64 include
John Baldwin
jhb at FreeBSD.org
Wed Jan 28 12:35:18 PST 2009
Author: jhb
Date: Wed Jan 28 20:35:16 2009
New Revision: 187867
URL: http://svn.freebsd.org/changeset/base/187867
Log:
Use a different value for the initial control word for the FPU state for
32-bit processes. The value matches the initial setting used by
FreeBSD/i386. Otherwise, 32-bit binaries using floating point would use
a slightly different initial state when run on FreeBSD/amd64.
MFC after: 1 week
Modified:
head/sys/amd64/amd64/fpu.c
head/sys/amd64/include/fpu.h
Modified: head/sys/amd64/amd64/fpu.c
==============================================================================
--- head/sys/amd64/amd64/fpu.c Wed Jan 28 20:06:02 2009 (r187866)
+++ head/sys/amd64/amd64/fpu.c Wed Jan 28 20:35:16 2009 (r187867)
@@ -391,6 +391,7 @@ fpudna()
{
struct pcb *pcb;
register_t s;
+ u_short control;
if (PCPU_GET(fpcurthread) == curthread) {
printf("fpudna: fpcurthread == curthread %d times\n",
@@ -421,6 +422,10 @@ fpudna()
* explicitly load sanitized registers.
*/
fxrstor(&fpu_cleanstate);
+ if (pcb->pcb_flags & PCB_32BIT) {
+ control = __INITIAL_FPUCW_I386__;
+ fldcw(&control);
+ }
pcb->pcb_flags |= PCB_FPUINITDONE;
} else
fxrstor(&pcb->pcb_save);
Modified: head/sys/amd64/include/fpu.h
==============================================================================
--- head/sys/amd64/include/fpu.h Wed Jan 28 20:06:02 2009 (r187866)
+++ head/sys/amd64/include/fpu.h Wed Jan 28 20:35:16 2009 (r187867)
@@ -92,6 +92,7 @@ struct savefpu {
* SSE2 based math. For FreeBSD/amd64, we go with the default settings.
*/
#define __INITIAL_FPUCW__ 0x037F
+#define __INITIAL_FPUCW_I386__ 0x127F
#define __INITIAL_MXCSR__ 0x1F80
#define __INITIAL_MXCSR_MASK__ 0xFFBF
More information about the svn-src-head
mailing list