Signed-off-by: Martin Storsjö martin@martin.st --- dlls/msvcrt/math.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 6f98d2ffaff..57345e634fe 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -6061,6 +6061,32 @@ int CDECL fesetenv(const fenv_t *env) if (fp_stat & _SW_DENORMAL) fpsr |= 0x80; __asm__ __volatile__( "msr fpsr, %0" :: "r" (fpsr) ); return 0; +#elif defined(__arm__) && !defined(__SOFTFP__) + DWORD fpscr; + unsigned int unused_cw, fp_cw, unused_stat, fp_stat; + + if (!env->_Fe_ctl && !env->_Fe_stat) { + _fpreset(); + return 0; + } + + if (!fenv_decode(env->_Fe_ctl, &unused_cw, &fp_cw)) + return 1; + if (!fenv_decode(env->_Fe_stat, &unused_stat, &fp_stat)) + return 1; + + _control87(fp_cw, 0xffffffff); + + __asm__ __volatile__( "vmrs %0, fpscr" : "=r" (fpscr) ); + fpscr &= ~0x9f; + if (fp_stat & _SW_INVALID) fpscr |= 0x1; + if (fp_stat & _SW_ZERODIVIDE) fpscr |= 0x2; + if (fp_stat & _SW_OVERFLOW) fpscr |= 0x4; + if (fp_stat & _SW_UNDERFLOW) fpscr |= 0x8; + if (fp_stat & _SW_INEXACT) fpscr |= 0x10; + if (fp_stat & _SW_DENORMAL) fpscr |= 0x80; + __asm__ __volatile__( "vmsr fpscr, %0" :: "r" (fpscr) ); + return 0; #else FIXME( "not implemented\n" ); #endif