mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-27 06:32:27 +00:00
Get rid of Sys_FPU_EnableExceptions()
No exceptions were ever enabled.
This commit is contained in:
parent
65b13cb73e
commit
93fdc96e60
8 changed files with 0 additions and 187 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -120,14 +120,6 @@ void Sys_Shutdown( void ) {
|
|||
Posix_Shutdown();
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Sys_FPU_EnableExceptions
|
||||
===============
|
||||
*/
|
||||
void Sys_FPU_EnableExceptions( int exceptions ) {
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Sys_FPE_handler
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue