Commit 4b17ec74 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Implemented _statusfp2.

parent a8d8e4a3
......@@ -1128,7 +1128,7 @@
@ cdecl _stat64(str ptr) msvcrt._stat64
@ cdecl _stat64i32(str ptr) msvcr90._stat64i32
@ cdecl _statusfp() msvcrt._statusfp
@ stub _statusfp2
@ cdecl -arch=i386 _statusfp2(ptr ptr) msvcrt._statusfp2
@ stub _strcoll_l
@ cdecl _strdate(ptr) msvcrt._strdate
@ cdecl _strdate_s(ptr long) msvcrt._strdate_s
......
......@@ -982,7 +982,7 @@
@ cdecl _stat64(str ptr) msvcrt._stat64
@ cdecl _stat64i32(str ptr) msvcr90._stat64i32
@ cdecl _statusfp() msvcrt._statusfp
@ stub _statusfp2
@ cdecl -arch=i386 _statusfp2(ptr ptr) msvcrt._statusfp2
@ stub _strcoll_l
@ cdecl _strdate(ptr) msvcrt._strdate
@ cdecl _strdate_s(ptr long) msvcrt._strdate_s
......
......@@ -968,7 +968,7 @@
@ cdecl _stat64(str ptr) msvcrt._stat64
@ cdecl _stat64i32(str ptr)
@ cdecl _statusfp() msvcrt._statusfp
@ stub _statusfp2
@ cdecl -arch=i386 _statusfp2(ptr ptr) msvcrt._statusfp2
@ stub _strcoll_l
@ cdecl _strdate(ptr) msvcrt._strdate
@ cdecl _strdate_s(ptr long) msvcrt._strdate_s
......
......@@ -768,25 +768,66 @@ void CDECL MSVCRT___setusermatherr(MSVCRT_matherr_func func)
}
/**********************************************************************
* _statusfp2 (MSVCRT.@)
*
* Not exported by native msvcrt, added in msvcr80.
*/
#if defined(__i386__) || defined(__x86_64__)
void CDECL _statusfp2( unsigned int *x86_sw, unsigned int *sse2_sw )
{
#ifdef __GNUC__
unsigned int flags;
unsigned long fpword;
if (x86_sw)
{
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) );
flags = 0;
if (fpword & 0x1) flags |= MSVCRT__SW_INVALID;
if (fpword & 0x2) flags |= MSVCRT__SW_DENORMAL;
if (fpword & 0x4) flags |= MSVCRT__SW_ZERODIVIDE;
if (fpword & 0x8) flags |= MSVCRT__SW_OVERFLOW;
if (fpword & 0x10) flags |= MSVCRT__SW_UNDERFLOW;
if (fpword & 0x20) flags |= MSVCRT__SW_INEXACT;
*x86_sw = flags;
}
if (!sse2_sw) return;
if (sse2_supported)
{
__asm__ __volatile__( "stmxcsr %0" : "=m" (fpword) );
flags = 0;
if (fpword & 0x1) flags |= MSVCRT__SW_INVALID;
if (fpword & 0x2) flags |= MSVCRT__SW_DENORMAL;
if (fpword & 0x4) flags |= MSVCRT__SW_ZERODIVIDE;
if (fpword & 0x8) flags |= MSVCRT__SW_OVERFLOW;
if (fpword & 0x10) flags |= MSVCRT__SW_UNDERFLOW;
if (fpword & 0x20) flags |= MSVCRT__SW_INEXACT;
*sse2_sw = flags;
}
else *sse2_sw = 0;
#else
FIXME( "not implemented\n" );
#endif
}
#endif
/**********************************************************************
* _statusfp (MSVCRT.@)
*/
unsigned int CDECL _statusfp(void)
{
unsigned int retVal = 0;
#if defined(__GNUC__) && defined(__i386__)
unsigned int fpword;
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );
if (fpword & 0x1) retVal |= MSVCRT__SW_INVALID;
if (fpword & 0x2) retVal |= MSVCRT__SW_DENORMAL;
if (fpword & 0x4) retVal |= MSVCRT__SW_ZERODIVIDE;
if (fpword & 0x8) retVal |= MSVCRT__SW_OVERFLOW;
if (fpword & 0x10) retVal |= MSVCRT__SW_UNDERFLOW;
if (fpword & 0x20) retVal |= MSVCRT__SW_INEXACT;
#if defined(__i386__) || defined(__x86_64__)
unsigned int x86_sw, sse2_sw;
_statusfp2( &x86_sw, &sse2_sw );
/* FIXME: there's no definition for ambiguous status, just return all status bits for now */
return x86_sw | sse2_sw;
#else
FIXME(":Not implemented!\n");
FIXME( "not implemented\n" );
return 0;
#endif
return retVal;
}
/*********************************************************************
......
......@@ -1485,5 +1485,6 @@
@ cdecl _set_abort_behavior(long long) MSVCRT__set_abort_behavior
@ cdecl _set_invalid_parameter_handler(ptr)
@ cdecl _set_purecall_handler(ptr)
@ cdecl -arch=i386 _statusfp2(ptr ptr)
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
@ cdecl _wdupenv_s(ptr ptr str)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment