1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * COPYRIGHT: See COPYING.LIB in the top level directory 3*c2c66affSColin Finck * PROJECT: ReactOS system libraries 4*c2c66affSColin Finck * PURPOSE: Resets FPU state to the default 5*c2c66affSColin Finck * PROGRAMER: Thomas Faber <thomas.faber@reactos.org> 6*c2c66affSColin Finck */ 7*c2c66affSColin Finck 8*c2c66affSColin Finck #include <precomp.h> 9*c2c66affSColin Finck 10*c2c66affSColin Finck /********************************************************************* 11*c2c66affSColin Finck * _fpreset (MSVCRT.@) 12*c2c66affSColin Finck */ _fpreset(void)13*c2c66affSColin Finckvoid CDECL _fpreset(void) 14*c2c66affSColin Finck { 15*c2c66affSColin Finck const unsigned short x86_cw = 0x27f; 16*c2c66affSColin Finck #ifdef _MSC_VER 17*c2c66affSColin Finck __asm { fninit } 18*c2c66affSColin Finck __asm { fldcw [x86_cw] } 19*c2c66affSColin Finck #else 20*c2c66affSColin Finck __asm__ __volatile__( "fninit; fldcw %0" : : "m" (x86_cw) ); 21*c2c66affSColin Finck #endif 22*c2c66affSColin Finck if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) 23*c2c66affSColin Finck { 24*c2c66affSColin Finck const unsigned long sse2_cw = 0x1f80; 25*c2c66affSColin Finck #ifdef _MSC_VER 26*c2c66affSColin Finck __asm { ldmxcsr [sse2_cw] } 27*c2c66affSColin Finck #else 28*c2c66affSColin Finck __asm__ __volatile__( "ldmxcsr %0" : : "m" (sse2_cw) ); 29*c2c66affSColin Finck #endif 30*c2c66affSColin Finck } 31*c2c66affSColin Finck } 32