mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-19 14:31:48 +01:00
Bugfix: feenableexcept() and fedisableexcept() should just return the
old exception mask, not mask | ~FE_ALL_EXCEPT. MFC after: 2 weeks
This commit is contained in:
parent
4b80fe0308
commit
741ae1d017
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226594
@ -135,12 +135,12 @@ __feenableexcept(int mask)
|
||||
mask &= FE_ALL_EXCEPT;
|
||||
__fnstcw(&control);
|
||||
__stmxcsr(&mxcsr);
|
||||
omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
control &= ~mask;
|
||||
__fldcw(control);
|
||||
mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
|
||||
__ldmxcsr(mxcsr);
|
||||
return (~omask);
|
||||
return (omask);
|
||||
}
|
||||
|
||||
int
|
||||
@ -152,12 +152,12 @@ __fedisableexcept(int mask)
|
||||
mask &= FE_ALL_EXCEPT;
|
||||
__fnstcw(&control);
|
||||
__stmxcsr(&mxcsr);
|
||||
omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
control |= mask;
|
||||
__fldcw(control);
|
||||
mxcsr |= mask << _SSE_EMASK_SHIFT;
|
||||
__ldmxcsr(mxcsr);
|
||||
return (~omask);
|
||||
return (omask);
|
||||
}
|
||||
|
||||
__weak_reference(__feenableexcept, feenableexcept);
|
||||
|
@ -192,14 +192,14 @@ __feenableexcept(int mask)
|
||||
__stmxcsr(&mxcsr);
|
||||
else
|
||||
mxcsr = 0;
|
||||
omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
control &= ~mask;
|
||||
__fldcw(control);
|
||||
if (__HAS_SSE()) {
|
||||
mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
|
||||
__ldmxcsr(mxcsr);
|
||||
}
|
||||
return (~omask);
|
||||
return (omask);
|
||||
}
|
||||
|
||||
int
|
||||
@ -214,14 +214,14 @@ __fedisableexcept(int mask)
|
||||
__stmxcsr(&mxcsr);
|
||||
else
|
||||
mxcsr = 0;
|
||||
omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
|
||||
control |= mask;
|
||||
__fldcw(control);
|
||||
if (__HAS_SSE()) {
|
||||
mxcsr |= mask << _SSE_EMASK_SHIFT;
|
||||
__ldmxcsr(mxcsr);
|
||||
}
|
||||
return (~omask);
|
||||
return (omask);
|
||||
}
|
||||
|
||||
__weak_reference(__feenableexcept, feenableexcept);
|
||||
|
Loading…
Reference in New Issue
Block a user