diff options
-rw-r--r-- | sys/amd64/amd64/fpu.c | 1 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 6 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 7 | ||||
-rw-r--r-- | sys/i386/isa/npx.c | 2 |
4 files changed, 7 insertions, 9 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 4c70e88..540966b 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -806,6 +806,7 @@ fpusetregs(struct thread *td, struct savefpu *addr, char *xfpustate, struct pcb *pcb; int error; + addr->sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 96d8c63..a0d34f0 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -2248,7 +2248,6 @@ static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { - struct savefpu *fpstate; int error; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) @@ -2261,9 +2260,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, error = 0; } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - fpstate = (struct savefpu *)&mcp->mc_fpstate; - fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; - error = fpusetregs(td, fpstate, xfpustate, xfpustate_len); + error = fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); } else return (EINVAL); return (error); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 9968714..aab7a3e 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -3138,7 +3138,6 @@ static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { - union savefpu *fpstate; int error; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) @@ -3152,10 +3151,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, error = 0; } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - fpstate = (union savefpu *)&mcp->mc_fpstate; - if (cpu_fxsr) - fpstate->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; - error = npxsetregs(td, fpstate, xfpustate, xfpustate_len); + error = npxsetregs(td, (union savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); } else return (EINVAL); return (error); diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 5ef616b2..2f15cb8 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -1053,6 +1053,8 @@ npxsetregs(struct thread *td, union savefpu *addr, char *xfpustate, if (!hw_float) return (ENXIO); + if (cpu_fxsr) + addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { |