From e1b708897ea547f25fbc5fc1f73bb2b0738c5757 Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 5 Mar 2009 19:42:11 +0000 Subject: A better fix for handling different FPU initial control words for different ABIs: - Store the FPU initial control word in the pcb for each thread. - When first using the FPU, load the initial control word after restoring the clean state if it is not the standard control word. - Provide a correct control word for Linux/i386 binaries under FreeBSD/amd64. - Adjust the control word returned for fpugetregs()/npxgetregs() when a thread hasn't used the FPU yet to reflect the real initial control word for the current ABI. - The Linux/i386 ABI for FreeBSD/i386 now properly sets the right control word instead of trashing whatever the current state of the FPU is. Reviewed by: bde --- sys/amd64/ia32/ia32_signal.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/amd64/ia32') diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index d3b9ae3..019faba 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -729,6 +729,7 @@ ia32_setregs(td, entry, stack, ps_strings) pcb->pcb_es = _udatasel; pcb->pcb_fs = _udatasel; pcb->pcb_gs = _udatasel; + pcb->pcb_initial_fpucw = __INITIAL_FPUCW_I386__; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = entry; -- cgit v1.1