Linux: A more complete rendition of the GCC compilation fix. Note: GCC requires non-const qualifiers on function pointers and function pointer-templated parameters, but not on void* (didn't know they were that different, did you?).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1057 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-04-24 13:49:00 +00:00
parent e3b217c57a
commit 4f08dc6bad
7 changed files with 33 additions and 29 deletions

View File

@ -64,3 +64,4 @@ void DispatcherReg();
} }
#endif #endif
#endif #endif

View File

@ -218,3 +218,4 @@ namespace StateRecovery
} }
#endif #endif

View File

@ -37,7 +37,7 @@ public:
// Special form for calling functions. This form automatically resolves the // Special form for calling functions. This form automatically resolves the
// correct displacement based on the size of the instruction being generated. // correct displacement based on the size of the instruction being generated.
template< typename T > template< typename T >
__forceinline void operator()( const T* func ) const __forceinline void operator()( T* func ) const
{ {
if( isJmp ) if( isJmp )
xJccKnownTarget( Jcc_Unconditional, (void*)(uptr)func, false ); // double cast to/from (uptr) needed to appease GCC xJccKnownTarget( Jcc_Unconditional, (void*)(uptr)func, false ); // double cast to/from (uptr) needed to appease GCC

View File

@ -208,7 +208,7 @@ namespace x86Emitter
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// JMP / Jcc Instructions! // JMP / Jcc Instructions!
extern void xJcc( JccComparisonType comparison, void* target ); extern void xJcc( JccComparisonType comparison, const void* target );
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Conditional jumps to fixed targets. // Conditional jumps to fixed targets.
@ -217,30 +217,30 @@ namespace x86Emitter
// the target (efficient!) // the target (efficient!)
// //
template< typename T > __forceinline void xJE(T* func ) { xJcc( Jcc_Equal, (void*)(uptr)func ); } template< typename T > __forceinline void xJE( T* func ) { xJcc( Jcc_Equal, (void*)(uptr)func ); }
template< typename T > __forceinline void xJZ(T* func ) { xJcc( Jcc_Zero, (void*)(uptr)func ); } template< typename T > __forceinline void xJZ( T* func ) { xJcc( Jcc_Zero, (void*)(uptr)func ); }
template< typename T > __forceinline void xJNE(T* func ) { xJcc( Jcc_NotEqual, (void*)(uptr)func ); } template< typename T > __forceinline void xJNE( T* func ) { xJcc( Jcc_NotEqual, (void*)(uptr)func ); }
template< typename T > __forceinline void xJNZ(T* func ) { xJcc( Jcc_NotZero, (void*)(uptr)func ); } template< typename T > __forceinline void xJNZ( T* func ) { xJcc( Jcc_NotZero, (void*)(uptr)func ); }
template< typename T > __forceinline void xJO(T* func ) { xJcc( Jcc_Overflow, (void*)(uptr)func ); } template< typename T > __forceinline void xJO( T* func ) { xJcc( Jcc_Overflow, (void*)(uptr)func ); }
template< typename T > __forceinline void xJNO(T* func ) { xJcc( Jcc_NotOverflow, (void*)(uptr)func ); } template< typename T > __forceinline void xJNO( T* func ) { xJcc( Jcc_NotOverflow, (void*)(uptr)func ); }
template< typename T > __forceinline void xJC(T* func ) { xJcc( Jcc_Carry, (void*)(uptr)func ); } template< typename T > __forceinline void xJC( T* func ) { xJcc( Jcc_Carry, (void*)(uptr)func ); }
template< typename T > __forceinline void xJNC(T* func ) { xJcc( Jcc_NotCarry, (void*)(uptr)func ); } template< typename T > __forceinline void xJNC( T* func ) { xJcc( Jcc_NotCarry, (void*)(uptr)func ); }
template< typename T > __forceinline void xJS(T* func ) { xJcc( Jcc_Signed, (void*)(uptr)func ); } template< typename T > __forceinline void xJS( T* func ) { xJcc( Jcc_Signed, (void*)(uptr)func ); }
template< typename T > __forceinline void xJNS(T* func ) { xJcc( Jcc_Unsigned, (void*)(uptr)func ); } template< typename T > __forceinline void xJNS( T* func ) { xJcc( Jcc_Unsigned, (void*)(uptr)func ); }
template< typename T > __forceinline void xJPE(T* func ) { xJcc( Jcc_ParityEven, (void*)(uptr)func ); } template< typename T > __forceinline void xJPE( T* func ) { xJcc( Jcc_ParityEven, (void*)(uptr)func ); }
template< typename T > __forceinline void xJPO(T* func ) { xJcc( Jcc_ParityOdd, (void*)(uptr)func ); } template< typename T > __forceinline void xJPO( T* func ) { xJcc( Jcc_ParityOdd, (void*)(uptr)func ); }
template< typename T > __forceinline void xJL(T* func ) { xJcc( Jcc_Less, (void*)(uptr)func ); } template< typename T > __forceinline void xJL( T* func ) { xJcc( Jcc_Less, (void*)(uptr)func ); }
template< typename T > __forceinline void xJLE(T* func ) { xJcc( Jcc_LessOrEqual, (void*)(uptr)func ); } template< typename T > __forceinline void xJLE( T* func ) { xJcc( Jcc_LessOrEqual, (void*)(uptr)func ); }
template< typename T > __forceinline void xJG(T* func ) { xJcc( Jcc_Greater, (void*)(uptr)func ); } template< typename T > __forceinline void xJG( T* func ) { xJcc( Jcc_Greater, (void*)(uptr)func ); }
template< typename T > __forceinline void xJGE(T* func ) { xJcc( Jcc_GreaterOrEqual, (void*)(uptr)func ); } template< typename T > __forceinline void xJGE( T* func ) { xJcc( Jcc_GreaterOrEqual, (void*)(uptr)func ); }
template< typename T > __forceinline void xJB(T* func ) { xJcc( Jcc_Below, (void*)(uptr)func ); } template< typename T > __forceinline void xJB( T* func ) { xJcc( Jcc_Below, (void*)(uptr)func ); }
template< typename T > __forceinline void xJBE(T* func ) { xJcc( Jcc_BelowOrEqual, (void*)(uptr)func ); } template< typename T > __forceinline void xJBE( T* func ) { xJcc( Jcc_BelowOrEqual, (void*)(uptr)func ); }
template< typename T > __forceinline void xJA(T* func ) { xJcc( Jcc_Above, (void*)(uptr)func ); } template< typename T > __forceinline void xJA( T* func ) { xJcc( Jcc_Above, (void*)(uptr)func ); }
template< typename T > __forceinline void xJAE(T* func ) { xJcc( Jcc_AboveOrEqual, (void*)(uptr)func ); } template< typename T > __forceinline void xJAE( T* func ) { xJcc( Jcc_AboveOrEqual, (void*)(uptr)func ); }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Forward Jump Helpers (act as labels!) // Forward Jump Helpers (act as labels!)

View File

@ -81,7 +81,7 @@ xSmartJump::~xSmartJump()
// slideForward - used internally by xSmartJump to indicate that the jump target is going // slideForward - used internally by xSmartJump to indicate that the jump target is going
// to slide forward in the event of an 8 bit displacement. // to slide forward in the event of an 8 bit displacement.
// //
__emitinline void Internal::xJccKnownTarget( JccComparisonType comparison, void* target, bool slideForward ) __emitinline void Internal::xJccKnownTarget( JccComparisonType comparison, const void* target, bool slideForward )
{ {
// Calculate the potential j8 displacement first, assuming an instruction length of 2: // Calculate the potential j8 displacement first, assuming an instruction length of 2:
sptr displacement8 = (sptr)target - ((sptr)xGetPtr() + 2); sptr displacement8 = (sptr)target - ((sptr)xGetPtr() + 2);
@ -115,9 +115,10 @@ __emitinline void Internal::xJccKnownTarget( JccComparisonType comparison, void*
// Low-level jump instruction! Specify a comparison type and a target in void* form, and // Low-level jump instruction! Specify a comparison type and a target in void* form, and
// a jump (either 8 or 32 bit) is generated. // a jump (either 8 or 32 bit) is generated.
__emitinline void xJcc( JccComparisonType comparison, void* target ) __emitinline void xJcc( JccComparisonType comparison, const void* target )
{ {
xJccKnownTarget( comparison, target, false ); xJccKnownTarget( comparison, target, false );
} }
} }

View File

@ -254,3 +254,4 @@ __forceinline void FreezeXMMRegs_(int save)
#ifndef __INTEL_COMPILER #ifndef __INTEL_COMPILER
} }
#endif #endif

View File

@ -686,7 +686,7 @@ __forceinline void xWrite( T val )
extern void SimdPrefix( u8 prefix, u16 opcode ); extern void SimdPrefix( u8 prefix, u16 opcode );
extern void EmitSibMagic( uint regfield, const void* address ); extern void EmitSibMagic( uint regfield, const void* address );
extern void EmitSibMagic( uint regfield, const ModSibBase& info ); extern void EmitSibMagic( uint regfield, const ModSibBase& info );
extern void xJccKnownTarget( JccComparisonType comparison, void* target, bool slideForward ); extern void xJccKnownTarget( JccComparisonType comparison, const void* target, bool slideForward );
// Writes a ModRM byte for "Direct" register access forms, which is used for all // Writes a ModRM byte for "Direct" register access forms, which is used for all