summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/fpu.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-01-28 20:35:16 +0000
committerjhb <jhb@FreeBSD.org>2009-01-28 20:35:16 +0000
commit3b7528c89c595d4d3a24d0d9915321d7a8eac6ac (patch)
tree662e59252d8be7f09e25c439ad9c89ba65dae02d /sys/amd64/amd64/fpu.c
parent4a6b5fa3784d5c1486f6b5cc7e08352ce7f6f958 (diff)
downloadFreeBSD-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/amd64/fpu.c')
-rw-r--r--sys/amd64/amd64/fpu.c5
1 files changed, 5 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);
OpenPOWER on IntegriCloud