summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Souza <luiz@netgate.com>2018-02-23 19:40:09 -0300
committerLuiz Souza <luiz@netgate.com>2018-02-23 19:40:09 -0300
commitb594788dcae53ea420f48e88b5cb5b7dc67b672a (patch)
tree1bb723e1fe649d621d87c7af8dbc97c74b7b5e67
parent87723fb19e17d7530d3c14f47c01e8f9d43dfd16 (diff)
downloadFreeBSD-src-b594788dcae53ea420f48e88b5cb5b7dc67b672a.zip
FreeBSD-src-b594788dcae53ea420f48e88b5cb5b7dc67b672a.tar.gz
Revert "Revert "MFC r325270:""
This reverts commit ffca621f122bcca1fcedc7db2747d2537e749ae4.
-rw-r--r--sys/amd64/amd64/fpu.c1
-rw-r--r--sys/amd64/amd64/machdep.c6
-rw-r--r--sys/i386/i386/machdep.c7
-rw-r--r--sys/i386/isa/npx.c2
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)) {
OpenPOWER on IntegriCloud