From 40310f021dcc3d82235e0dd9debb9a50d2ddf1fe Mon Sep 17 00:00:00 2001 From: David Xu Date: Sun, 28 May 2006 04:40:45 +0000 Subject: [PATCH] If parent thread never used FPU, the only work is to clear flag PCB_NPXINITDONE for new thread and let trap code initialize it. --- sys/i386/isa/npx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 7b7f3a5c670d..129a853f20ed 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -952,9 +952,14 @@ npx_fork_thread(struct thread *td, struct thread *newtd) u_int32_t mxcsr; u_int32_t cw; + if (!(td->td_pcb->pcb_flags & PCB_NPXINITDONE)) { + newtd->td_pcb->pcb_flags &= ~PCB_NPXINITDONE; + return; + } + state = &newtd->td_pcb->pcb_save; /* get control word */ - if (npxgetregs(td, &newtd->td_pcb->pcb_save)) + if (npxgetregs(td, state)) return; if (cpu_fxsr) { mxcsr = state->sv_xmm.sv_env.en_mxcsr;