diff --git a/neo/TypeInfo/main.cpp b/neo/TypeInfo/main.cpp index e96f95ad..aa785a8e 100644 --- a/neo/TypeInfo/main.cpp +++ b/neo/TypeInfo/main.cpp @@ -224,8 +224,6 @@ sysEvent_t idSysLocal::GenerateMouseMoveEvent( int deltax, int deltay ) { sysEv void idSysLocal::OpenURL( const char *url, bool quit ) { } void idSysLocal::StartProcess( const char *exeName, bool quit ) { } -void idSysLocal::FPU_EnableExceptions( int exceptions ) { } - idSysLocal sysLocal; idSys * sys = &sysLocal; diff --git a/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp index b59b38e7..b2a82dc2 100644 --- a/neo/sys/linux/main.cpp +++ b/neo/sys/linux/main.cpp @@ -120,14 +120,6 @@ void Sys_Shutdown( void ) { Posix_Shutdown(); } -/* -=============== -Sys_FPU_EnableExceptions -=============== -*/ -void Sys_FPU_EnableExceptions( int exceptions ) { -} - /* =============== Sys_FPE_handler diff --git a/neo/sys/osx/DOOMController.mm b/neo/sys/osx/DOOMController.mm index e34caf52..bfb62414 100644 --- a/neo/sys/osx/DOOMController.mm +++ b/neo/sys/osx/DOOMController.mm @@ -41,15 +41,6 @@ If you have questions concerning this license or the applicable additional terms #include "sys/posix/posix_public.h" -#define TEST_FPU_EXCEPTIONS \ -FPU_EXCEPTION_INVALID_OPERATION | \ -FPU_EXCEPTION_DENORMALIZED_OPERAND | \ -FPU_EXCEPTION_DIVIDE_BY_ZERO | \ -/* FPU_EXCEPTION_NUMERIC_OVERFLOW | */ \ -/* FPU_EXCEPTION_NUMERIC_UNDERFLOW | */ \ -/* FPU_EXCEPTION_INEXACT_RESULT | */ \ -0 - bool Sys_GetPath(sysPath_t type, idStr &path) { char buf[MAXPATHLEN]; char *snap; @@ -88,110 +79,6 @@ void Sys_Shutdown( void ) { Posix_Shutdown(); } -/* -=============== -Sys_FPU_EnableExceptions -http://developer.apple.com/documentation/mac/PPCNumerics/PPCNumerics-154.html -http://developer.apple.com/documentation/Performance/Conceptual/Mac_OSX_Numerics/Mac_OSX_Numerics.pdf -=============== -*/ - -#define fegetenvd(x) asm volatile( "mffs %0" : "=f" (x) ); -#define fesetenvd(x) asm volatile( "mtfsf 255,%0" : : "f" (x) ); -enum { - FE_ENABLE_INEXACT = 0x8, - FE_ENABLE_DIVBYZERO = 0x10, - FE_ENABLE_UNDERFLOW = 0x20, - FE_ENABLE_OVERFLOW = 0x40, - FE_ENABLE_INVALID = 0x80, - FE_ENABLE_ALL_EXCEPT = 0xF8 -}; - -typedef union { - struct { - unsigned long hi; - unsigned long lo; - } i; - double d; -} hexdouble; - -static int exception_mask = 0; - -void Sys_FPU_EnableExceptions( int exceptions ) { -#if 0 - if ( exceptions & ( FPU_EXCEPTION_INVALID_OPERATION | FPU_EXCEPTION_DENORMALIZED_OPERAND ) ) { - // clear the flag before enabling the exception - asm( "mtfsb0 2" ); - asm( "mtfsb0 7" ); - asm( "mtfsb0 8" ); - asm( "mtfsb0 9" ); - asm( "mtfsb0 10" ); - asm( "mtfsb0 11" ); - asm( "mtfsb0 12" ); - asm( "mtfsb0 21" ); - asm( "mtfsb0 22" ); - asm( "mtfsb0 23" ); - // enable - asm( "mtfsb1 24" ); - } else { - asm( "mtfsb0 24" ); - } - if ( exceptions & FPU_EXCEPTION_DIVIDE_BY_ZERO ) { - asm( "mtfsb0 5" ); - asm( "mtfsb1 27" ); - } else { - asm( "mtfsb0 27" ); - } - if ( exceptions & FPU_EXCEPTION_NUMERIC_OVERFLOW ) { - asm( "mtfsb0 3" ); - asm( "mtfsb1 25" ); - } else { - asm( "mtfsb0 25" ); - } - if ( exceptions & FPU_EXCEPTION_NUMERIC_UNDERFLOW ) { - asm( "mtfsb0 4" ); - asm( "mtfsb1 26" ); - } else { - asm( "mtfsb0 26" ); - } - if ( exceptions & FPU_EXCEPTION_INEXACT_RESULT ) { - asm( "mtfsb0 6" ); - asm( "mtfsb0 13" ); - asm( "mtfsb0 14" ); - asm( "mtfsb1 28" ); - } else { - asm( "mtfsb0 28" ); - } -#elif defined(__ppc__) - hexdouble t; - exception_mask = 0; - if ( exceptions & ( FPU_EXCEPTION_INVALID_OPERATION | FPU_EXCEPTION_DENORMALIZED_OPERAND ) ) { - exception_mask |= FE_ENABLE_INVALID; - } - if ( exceptions & FPU_EXCEPTION_DIVIDE_BY_ZERO ) { - exception_mask |= FE_ENABLE_DIVBYZERO; - } - if ( exceptions & FPU_EXCEPTION_NUMERIC_OVERFLOW ) { - exception_mask |= FE_ENABLE_OVERFLOW; - } - if ( exceptions & FPU_EXCEPTION_NUMERIC_UNDERFLOW ) { - exception_mask |= FE_ENABLE_UNDERFLOW; - } - if ( exceptions & FPU_EXCEPTION_INEXACT_RESULT ) { - exception_mask |= FE_ENABLE_INVALID; - } - Sys_Printf( "Sys_FPUEnableExceptions: 0x%x\n", exception_mask ); - // clear the exception flags - feclearexcept( FE_ALL_EXCEPT ); - // set the enable flags on the exceptions we want - fegetenvd( t.d ); - t.i.lo &= ~FE_ENABLE_ALL_EXCEPT; - t.i.lo |= exception_mask; - fesetenvd( t.d ); - Sys_Printf( "done\n" ); -#endif -} - /* =============== Sys_FPE_handler @@ -334,8 +221,6 @@ int main( int argc, char *argv[] ) { if (![[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]) Sys_Error("Could not access application resources"); - //Sys_FPU_EnableExceptions(TEST_FPU_EXCEPTIONS); - Posix_EarlyInit(); if (argc > 1) @@ -348,9 +233,6 @@ int main( int argc, char *argv[] ) { [NSApp activateIgnoringOtherApps:YES]; while (1) { - // maintain exceptions in case system calls are turning them off (is that needed) - //Sys_FPU_EnableExceptions(TEST_FPU_EXCEPTIONS); - common->Frame(); // We should think about doing this less frequently than every frame diff --git a/neo/sys/sys_local.cpp b/neo/sys/sys_local.cpp index efc63893..e73a6000 100644 --- a/neo/sys/sys_local.cpp +++ b/neo/sys/sys_local.cpp @@ -121,10 +121,6 @@ sysEvent_t idSysLocal::GenerateMouseMoveEvent( int deltax, int deltay ) { return ev; } -void idSysLocal::FPU_EnableExceptions( int exceptions ) { - Sys_FPU_EnableExceptions( exceptions ); -} - /* ================= Sys_TimeStampToStr diff --git a/neo/sys/sys_local.h b/neo/sys/sys_local.h index 02c71065..646555d5 100644 --- a/neo/sys/sys_local.h +++ b/neo/sys/sys_local.h @@ -53,8 +53,6 @@ public: virtual void FPU_SetFTZ( bool enable ); virtual void FPU_SetDAZ( bool enable ); - virtual void FPU_EnableExceptions( int exceptions ); - virtual bool LockMemory( void *ptr, int bytes ); virtual bool UnlockMemory( void *ptr, int bytes ); diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index 79d3297a..0a63a69f 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -43,15 +43,6 @@ typedef enum { CPUID_ALTIVEC = 0x00200, // AltiVec } cpuid_t; -typedef enum { - FPU_EXCEPTION_INVALID_OPERATION = 1, - FPU_EXCEPTION_DENORMALIZED_OPERAND = 2, - FPU_EXCEPTION_DIVIDE_BY_ZERO = 4, - FPU_EXCEPTION_NUMERIC_OVERFLOW = 8, - FPU_EXCEPTION_NUMERIC_UNDERFLOW = 16, - FPU_EXCEPTION_INEXACT_RESULT = 32 -} fpuExceptions_t; - typedef enum { AXIS_SIDE, AXIS_FORWARD, @@ -148,9 +139,6 @@ bool Sys_FPU_StackIsEmpty( void ); // returns the FPU state as a string const char * Sys_FPU_GetState( void ); -// enables the given FPU exceptions -void Sys_FPU_EnableExceptions( int exceptions ); - // sets the FPU precision void Sys_FPU_SetPrecision(); @@ -385,8 +373,6 @@ public: virtual void FPU_SetFTZ( bool enable ) = 0; virtual void FPU_SetDAZ( bool enable ) = 0; - virtual void FPU_EnableExceptions( int exceptions ) = 0; - virtual bool LockMemory( void *ptr, int bytes ) = 0; virtual bool UnlockMemory( void *ptr, int bytes ) = 0; diff --git a/neo/sys/win32/win_cpu.cpp b/neo/sys/win32/win_cpu.cpp index 7bbecffe..3e0c9c1f 100644 --- a/neo/sys/win32/win_cpu.cpp +++ b/neo/sys/win32/win_cpu.cpp @@ -251,25 +251,3 @@ const char *Sys_FPU_GetState( void ) { return ""; #endif } - -/* -=============== -Sys_FPU_EnableExceptions -=============== -*/ -void Sys_FPU_EnableExceptions( int exceptions ) { -#ifdef _MSC_VER - __asm { - mov eax, statePtr - mov ecx, exceptions - and cx, 63 - not cx - fnstcw word ptr [eax] - mov bx, word ptr [eax] - or bx, 63 - and bx, cx - mov word ptr [eax], bx - fldcw word ptr [eax] - } -#endif -} diff --git a/neo/sys/win32/win_main.cpp b/neo/sys/win32/win_main.cpp index a63c8926..b580dba4 100644 --- a/neo/sys/win32/win_main.cpp +++ b/neo/sys/win32/win_main.cpp @@ -621,14 +621,6 @@ void Win_Frame( void ) { int Sys_FPU_PrintStateFlags( char *ptr, int ctrl, int stat, int tags, int inof, int inse, int opof, int opse ); -#define TEST_FPU_EXCEPTIONS /* FPU_EXCEPTION_INVALID_OPERATION | */ \ - /* FPU_EXCEPTION_DENORMALIZED_OPERAND | */ \ - /* FPU_EXCEPTION_DIVIDE_BY_ZERO | */ \ - /* FPU_EXCEPTION_NUMERIC_OVERFLOW | */ \ - /* FPU_EXCEPTION_NUMERIC_UNDERFLOW | */ \ - /* FPU_EXCEPTION_INEXACT_RESULT | */ \ - 0 - /* ================== WinMain @@ -652,18 +644,12 @@ int main(int argc, char *argv[]) { _CrtSetDbgFlag( 0 ); #endif -// Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS ); - if ( argc > 1 ) { common->Init( argc-1, &argv[1] ); } else { common->Init( 0, NULL ); } -#if TEST_FPU_EXCEPTIONS != 0 - common->Printf( Sys_FPU_GetState() ); -#endif - // hide or show the early console as necessary if ( win32.win_viewlog.GetInteger() || com_skipRenderer.GetBool() || idAsyncNetwork::serverDedicated.GetInteger() ) { Sys_ShowConsole( 1, true ); @@ -691,9 +677,6 @@ int main(int argc, char *argv[]) { Win_Frame(); - // set exceptions, even if some crappy syscall changes them! - Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS ); - #ifdef ID_ALLOW_TOOLS if ( com_editors ) { if ( com_editors & EDITOR_GUI ) {