Get rid of Sys_FPU_GetState()

This was only implemented with MSVC style asm.
Comments suggest that it was used to help catch invalid FOV calculations,
which were probably only happening with ancient compiler bugs.
This commit is contained in:
dhewg 2012-07-05 22:55:05 +02:00
parent 93fdc96e60
commit 0ccef1eba8
9 changed files with 0 additions and 131 deletions

View file

@ -205,7 +205,6 @@ void idSysLocal::DebugVPrintf( const char *fmt, va_list arg ) {}
double idSysLocal::GetClockTicks( void ) { return 0.0; }
double idSysLocal::ClockTicksPerSecond( void ) { return 1.0; }
int idSysLocal::GetProcessorId( void ) { return 0; }
const char * idSysLocal::FPU_GetState( void ) { return ""; }
bool idSysLocal::FPU_StackIsEmpty( void ) { return true; }
void idSysLocal::FPU_SetFTZ( bool enable ) {}
void idSysLocal::FPU_SetDAZ( bool enable ) {}

View file

@ -2657,7 +2657,6 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
float ratio_y;
if ( !sys->FPU_StackIsEmpty() ) {
Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: FPU stack not empty" );
}
@ -2669,7 +2668,6 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// FIXME: somehow, this is happening occasionally
assert( fov_y > 0 );
if ( fov_y <= 0 ) {
Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: bad result" );
}
@ -2706,7 +2704,6 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// FIXME: somehow, this is happening occasionally
assert( ( fov_x > 0 ) && ( fov_y > 0 ) );
if ( ( fov_y <= 0 ) || ( fov_x <= 0 ) ) {
Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: bad result" );
}
}

View file

@ -2429,7 +2429,6 @@ void idCommonLocal::Frame( void ) {
// the FPU stack better be empty at this point or some bad code or compiler bug left values on the stack
if ( !Sys_FPU_StackIsEmpty() ) {
Printf( Sys_FPU_GetState() );
FatalError( "idCommon::Frame: the FPU stack is not empty at the end of the frame\n" );
}
}

View file

@ -2392,7 +2392,6 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
float ratio_y;
if ( !sys->FPU_StackIsEmpty() ) {
Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: FPU stack not empty" );
}
@ -2404,7 +2403,6 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// FIXME: somehow, this is happening occasionally
assert( fov_y > 0 );
if ( fov_y <= 0 ) {
Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: bad result" );
}
@ -2441,7 +2439,6 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
// FIXME: somehow, this is happening occasionally
assert( ( fov_x > 0 ) && ( fov_y > 0 ) );
if ( ( fov_y <= 0 ) || ( fov_x <= 0 ) ) {
Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: bad result" );
}
}

View file

@ -319,10 +319,6 @@ bool Sys_FPU_StackIsEmpty( void ) {
return true;
}
const char *Sys_FPU_GetState( void ) {
return "";
}
/*
================
Sys_LockMemory

View file

@ -61,10 +61,6 @@ int idSysLocal::GetProcessorId( void ) {
return Sys_GetProcessorId();
}
const char *idSysLocal::FPU_GetState( void ) {
return Sys_FPU_GetState();
}
bool idSysLocal::FPU_StackIsEmpty( void ) {
return Sys_FPU_StackIsEmpty();
}

View file

@ -48,7 +48,6 @@ public:
virtual unsigned int GetMilliseconds( void );
virtual int GetProcessorId( void );
virtual const char * FPU_GetState( void );
virtual bool FPU_StackIsEmpty( void );
virtual void FPU_SetFTZ( bool enable );
virtual void FPU_SetDAZ( bool enable );

View file

@ -136,9 +136,6 @@ int Sys_GetProcessorId( void );
// returns true if the FPU stack is empty
bool Sys_FPU_StackIsEmpty( void );
// returns the FPU state as a string
const char * Sys_FPU_GetState( void );
// sets the FPU precision
void Sys_FPU_SetPrecision();
@ -368,7 +365,6 @@ public:
virtual unsigned int GetMilliseconds( void ) = 0;
virtual int GetProcessorId( void ) = 0;
virtual const char * FPU_GetState( void ) = 0;
virtual bool FPU_StackIsEmpty( void ) = 0;
virtual void FPU_SetFTZ( bool enable ) = 0;
virtual void FPU_SetDAZ( bool enable ) = 0;

View file

@ -141,113 +141,3 @@ empty:
return true;
#endif
}
/*
===============
Sys_FPU_GetState
gets the FPU state without changing the state
===============
*/
const char *Sys_FPU_GetState( void ) {
#ifdef _MSC_VER
double fpuStack[8] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
double *fpuStackPtr = fpuStack;
int i, numValues;
char *ptr;
__asm {
mov esi, statePtr
mov edi, fpuStackPtr
fnstenv [esi]
mov esi, [esi+8]
xor esi, 0xFFFFFFFF
mov edx, (3<<14)
xor eax, eax
mov ecx, esi
and ecx, edx
jz done
fst qword ptr [edi+0]
inc eax
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(1)
fst qword ptr [edi+8]
inc eax
fxch st(1)
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(2)
fst qword ptr [edi+16]
inc eax
fxch st(2)
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(3)
fst qword ptr [edi+24]
inc eax
fxch st(3)
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(4)
fst qword ptr [edi+32]
inc eax
fxch st(4)
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(5)
fst qword ptr [edi+40]
inc eax
fxch st(5)
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(6)
fst qword ptr [edi+48]
inc eax
fxch st(6)
shr edx, 2
mov ecx, esi
and ecx, edx
jz done
fxch st(7)
fst qword ptr [edi+56]
inc eax
fxch st(7)
done:
mov numValues, eax
}
int ctrl = *(int *)&fpuState[0];
int stat = *(int *)&fpuState[4];
int tags = *(int *)&fpuState[8];
int inof = *(int *)&fpuState[12];
int inse = *(int *)&fpuState[16];
int opof = *(int *)&fpuState[20];
int opse = *(int *)&fpuState[24];
ptr = fpuString;
ptr += sprintf( ptr,"FPU State:\n"
"num values on stack = %d\n", numValues );
for ( i = 0; i < 8; i++ ) {
ptr += sprintf( ptr, "ST%d = %1.10e\n", i, fpuStack[i] );
}
Sys_FPU_PrintStateFlags( ptr, ctrl, stat, tags, inof, inse, opof, opse );
return fpuString;
#else
return "";
#endif
}