Date: Wed, 28 Jan 2009 20:35:16 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r187867 - in head/sys/amd64: amd64 include Message-ID: <200901282035.n0SKZGun032684@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901282035.n0SKZGun032684>