diff --git a/common/include/x86emitter/x86types.h b/common/include/x86emitter/x86types.h index 104c4a94fd..c836e53c8a 100644 --- a/common/include/x86emitter/x86types.h +++ b/common/include/x86emitter/x86types.h @@ -268,6 +268,7 @@ template< typename T > void xWrite( T val ); // Diagnostics -- returns a string representation of this register. Return string // is a valid non-null string for any Id, valid or invalid. No assertions are generated. const char* GetName(); + int GetId() const { return Id; } }; class xRegisterInt : public xRegisterBase diff --git a/pcsx2/x86/iCore.h b/pcsx2/x86/iCore.h index e06692773b..dcbd630b89 100644 --- a/pcsx2/x86/iCore.h +++ b/pcsx2/x86/iCore.h @@ -126,6 +126,7 @@ void _deleteX86reg(int type, int reg, int flush); int _checkX86reg(int type, int reg, int mode); void _addNeededX86reg(int type, int reg); void _clearNeededX86regs(); +void _freeX86reg(const x86Emitter::xRegister32& x86reg); void _freeX86reg(int x86reg); void _freeX86regs(); void _flushCachedRegs(); diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 08bd93fc86..36bb32a6a6 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -574,9 +574,9 @@ void _psxMoveGPRtoRm(x86IntRegType to, int fromgpr) void _psxFlushCall(int flushtype) { // x86-32 ABI : These registers are not preserved across calls: - _freeX86reg( EAX ); - _freeX86reg( ECX ); - _freeX86reg( EDX ); + _freeX86reg( eax ); + _freeX86reg( ecx ); + _freeX86reg( edx ); if( flushtype & FLUSH_CACHED_REGS ) _psxFlushConstRegs(); diff --git a/pcsx2/x86/ix86-32/iCore-32.cpp b/pcsx2/x86/ix86-32/iCore-32.cpp index 968e8c748d..46785bdce3 100644 --- a/pcsx2/x86/ix86-32/iCore-32.cpp +++ b/pcsx2/x86/ix86-32/iCore-32.cpp @@ -442,6 +442,12 @@ void _deleteX86reg(int type, int reg, int flush) } } +// Temporary solution to support eax/ebx... type +void _freeX86reg(const x86Emitter::xRegister32& x86reg) +{ + _freeX86reg(x86reg.GetId()); +} + void _freeX86reg(int x86reg) { pxAssert( x86reg >= 0 && x86reg < (int)iREGCNT_GPR ); diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index f63589c650..7371b4c027 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -1039,9 +1039,9 @@ void LoadBranchState() void iFlushCall(int flushtype) { // Free registers that are not saved across function calls (x86-32 ABI): - _freeX86reg(EAX); - _freeX86reg(ECX); - _freeX86reg(EDX); + _freeX86reg(eax); + _freeX86reg(ecx); + _freeX86reg(edx); if ((flushtype & FLUSH_PC) && !g_cpuFlushedPC) { xMOV(ptr32[&cpuRegs.pc], pc); diff --git a/pcsx2/x86/sVU_Upper.cpp b/pcsx2/x86/sVU_Upper.cpp index 0b3da61ba8..fedef0f0d2 100644 --- a/pcsx2/x86/sVU_Upper.cpp +++ b/pcsx2/x86/sVU_Upper.cpp @@ -345,7 +345,7 @@ void VU_ADD_SUB(u32 regd, u32 regt, int is_sub, int info) if (temp2 == ECX) { temp2 = ALLOCTEMPX86(0); - _freeX86reg(ECX); + _freeX86reg(ecx); } xMOVAPS(ptr[&VU_addsub_reg[0][0]], xRegisterSSE(regd)); @@ -440,7 +440,7 @@ void VU_ADD_SUB_SS(u32 regd, u32 regt, int is_sub, int is_mem, int info) if (temp2 == ECX) { temp2 = ALLOCTEMPX86(0); - _freeX86reg(ECX); + _freeX86reg(ecx); } xMOVAPS(ptr[&VU_addsub_reg[0][0]], xRegisterSSE(regd));