diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c index fecd67e8d33..c115c9c71b1 100644 --- a/dlls/ntdll/misc.c +++ b/dlls/ntdll/misc.c @@ -52,72 +52,6 @@ LPCSTR debugstr_us( const UNICODE_STRING *us ) return debugstr_wn(us->Buffer, us->Length / sizeof(WCHAR)); } -/********************************************************************* - * _ftol (NTDLL.@) - * - * VERSION - * [GNUC && i386] - */ -#if defined(__GNUC__) && defined(__i386__) -LONGLONG CDECL NTDLL__ftol(void) -{ - /* don't just do DO_FPU("fistp",retval), because the rounding - * mode must also be set to "round towards zero"... */ - double fl; - POP_FPU(fl); - return (LONGLONG)fl; -} -#endif /* defined(__GNUC__) && defined(__i386__) */ - -/********************************************************************* - * _ftol (NTDLL.@) - * - * FIXME - * Should be register function - * VERSION - * [!GNUC && i386] - */ -#if !defined(__GNUC__) && defined(__i386__) -LONGLONG CDECL NTDLL__ftol(double fl) -{ - FIXME("should be register function\n"); - return (LONGLONG)fl; -} -#endif /* !defined(__GNUC__) && defined(__i386__) */ - -/********************************************************************* - * _CIpow (NTDLL.@) - * VERSION - * [GNUC && i386] - */ -#if defined(__GNUC__) && defined(__i386__) -double CDECL NTDLL__CIpow(void) -{ - double x,y; - POP_FPU(y); - POP_FPU(x); - return pow(x,y); -} -#endif /* defined(__GNUC__) && defined(__i386__) */ - - -/********************************************************************* - * _CIpow (NTDLL.@) - * - * FIXME - * Should be register function - * - * VERSION - * [!GNUC && i386] - */ -#if !defined(__GNUC__) && defined(__i386__) -double CDECL NTDLL__CIpow(double x,double y) -{ - FIXME("should be register function\n"); - return pow(x,y); -} -#endif /* !defined(__GNUC__) && defined(__i386__) */ - /********************************************************************* * wine_get_version (NTDLL.@) */ @@ -252,6 +186,69 @@ double CDECL NTDLL_tan( double d ) return tan( d ); } +#if defined(__GNUC__) && defined(__i386__) + +#define FPU_DOUBLE(var) double var; \ + __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : ) +#define FPU_DOUBLES(var1,var2) double var1,var2; \ + __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \ + __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : ) + +/********************************************************************* + * _CIcos (NTDLL.@) + */ +double CDECL NTDLL__CIcos(void) +{ + FPU_DOUBLE(x); + return NTDLL_cos(x); +} + +/********************************************************************* + * _CIlog (NTDLL.@) + */ +double CDECL NTDLL__CIlog(void) +{ + FPU_DOUBLE(x); + return NTDLL_log(x); +} + +/********************************************************************* + * _CIpow (NTDLL.@) + */ +double CDECL NTDLL__CIpow(void) +{ + FPU_DOUBLES(x,y); + return NTDLL_pow(x,y); +} + +/********************************************************************* + * _CIsin (NTDLL.@) + */ +double CDECL NTDLL__CIsin(void) +{ + FPU_DOUBLE(x); + return NTDLL_sin(x); +} + +/********************************************************************* + * _CIsqrt (NTDLL.@) + */ +double CDECL NTDLL__CIsqrt(void) +{ + FPU_DOUBLE(x); + return NTDLL_sqrt(x); +} + +/********************************************************************* + * _ftol (NTDLL.@) + */ +LONGLONG CDECL NTDLL__ftol(void) +{ + FPU_DOUBLE(x); + return (LONGLONG)x; +} + +#endif /* defined(__GNUC__) && defined(__i386__) */ static void NTDLL_mergesort( void *arr, void *barr, size_t elemsize, int(__cdecl *compar)(const void *, const void *), diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 19ff8e447c8..d144986868b 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1240,11 +1240,11 @@ @ stub ZwWriteRequestData @ stdcall ZwWriteVirtualMemory(long ptr ptr long ptr) NtWriteVirtualMemory @ stdcall ZwYieldExecution() NtYieldExecution -# @ stub _CIcos -# @ stub _CIlog +@ cdecl -private -arch=i386 _CIcos() NTDLL__CIcos +@ cdecl -private -arch=i386 _CIlog() NTDLL__CIlog @ cdecl -private -arch=i386 _CIpow() NTDLL__CIpow -# @ stub _CIsin -# @ stub _CIsqrt +@ cdecl -private -arch=i386 _CIsin() NTDLL__CIsin +@ cdecl -private -arch=i386 _CIsqrt() NTDLL__CIsqrt @ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) @ stdcall -private -arch=x86_64 -norelay __chkstk() # @ stub __isascii