msvcrt: Fix x87 FPU status register assignment detection.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51568
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51579
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-08-09 00:28:08 +02:00 committed by Alexandre Julliard
parent 2cc98b7284
commit 62d2693701
1 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@
* ==================================================== * ====================================================
*/ */
#include <assert.h>
#include <complex.h> #include <complex.h>
#include <stdio.h> #include <stdio.h>
#include <fenv.h> #include <fenv.h>
@ -5321,7 +5322,7 @@ static BOOL _setfp( unsigned int *cw, unsigned int cw_mask,
if (*cw & _IC_AFFINE) newcw |= 0x1000; if (*cw & _IC_AFFINE) newcw |= 0x1000;
} }
if (oldsw != newsw && newsw) if (oldsw != newsw && (newsw & 0x3f))
{ {
struct { struct {
WORD control_word; WORD control_word;
@ -5338,6 +5339,8 @@ static BOOL _setfp( unsigned int *cw, unsigned int cw_mask,
WORD unused5; WORD unused5;
} fenv; } fenv;
assert(cw);
__asm__ __volatile__( "fnstenv %0" : "=m" (fenv) ); __asm__ __volatile__( "fnstenv %0" : "=m" (fenv) );
fenv.control_word = newcw; fenv.control_word = newcw;
fenv.status_word = newsw; fenv.status_word = newsw;