diff options
author | jhb <jhb@FreeBSD.org> | 2009-01-28 20:35:16 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-01-28 20:35:16 +0000 |
commit | 3b7528c89c595d4d3a24d0d9915321d7a8eac6ac (patch) | |
tree | 662e59252d8be7f09e25c439ad9c89ba65dae02d /sys/amd64 | |
parent | 4a6b5fa3784d5c1486f6b5cc7e08352ce7f6f958 (diff) | |
download | FreeBSD-src-3b7528c89c595d4d3a24d0d9915321d7a8eac6ac.zip FreeBSD-src-3b7528c89c595d4d3a24d0d9915321d7a8eac6ac.tar.gz |
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
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/fpu.c | 5 | ||||
-rw-r--r-- | sys/amd64/include/fpu.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 513b36b..d051713 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -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); diff --git a/sys/amd64/include/fpu.h b/sys/amd64/include/fpu.h index 88932ed..9b99fd8 100644 --- a/sys/amd64/include/fpu.h +++ b/sys/amd64/include/fpu.h @@ -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 |