svn commit: r325542 - in stable/11/sys: amd64/amd64 i386/i386 i386/isa
Konstantin Belousov
kib at FreeBSD.org
Wed Nov 8 11:25:21 UTC 2017
Author: kib
Date: Wed Nov 8 11:25:19 2017
New Revision: 325542
URL: https://svnweb.freebsd.org/changeset/base/325542
Log:
MFC r325270:
Consistently ensure that we do not load MXCSR with reserved bits set.
Modified:
stable/11/sys/amd64/amd64/fpu.c
stable/11/sys/amd64/amd64/machdep.c
stable/11/sys/i386/i386/machdep.c
stable/11/sys/i386/isa/npx.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/amd64/amd64/fpu.c
==============================================================================
--- stable/11/sys/amd64/amd64/fpu.c Wed Nov 8 09:36:59 2017 (r325541)
+++ stable/11/sys/amd64/amd64/fpu.c Wed Nov 8 11:25:19 2017 (r325542)
@@ -806,6 +806,7 @@ fpusetregs(struct thread *td, struct savefpu *addr, ch
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)) {
Modified: stable/11/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/11/sys/amd64/amd64/machdep.c Wed Nov 8 09:36:59 2017 (r325541)
+++ stable/11/sys/amd64/amd64/machdep.c Wed Nov 8 11:25:19 2017 (r325542)
@@ -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
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);
Modified: stable/11/sys/i386/i386/machdep.c
==============================================================================
--- stable/11/sys/i386/i386/machdep.c Wed Nov 8 09:36:59 2017 (r325541)
+++ stable/11/sys/i386/i386/machdep.c Wed Nov 8 11:25:19 2017 (r325542)
@@ -3147,7 +3147,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)
@@ -3161,10 +3160,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char
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);
Modified: stable/11/sys/i386/isa/npx.c
==============================================================================
--- stable/11/sys/i386/isa/npx.c Wed Nov 8 09:36:59 2017 (r325541)
+++ stable/11/sys/i386/isa/npx.c Wed Nov 8 11:25:19 2017 (r325542)
@@ -1053,6 +1053,8 @@ npxsetregs(struct thread *td, union savefpu *addr, cha
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)) {
More information about the svn-src-stable-11
mailing list