More CR usage cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1548 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-12-15 19:40:12 +00:00
parent 866d4e6bc8
commit 5c831a934b
5 changed files with 17 additions and 18 deletions

View File

@ -9,7 +9,7 @@ protected:
virtual ~DebugInterface() {} virtual ~DebugInterface() {}
public: public:
virtual void disasm(unsigned int /*address*/, char *dest, int max_size) {strcpy(dest, "NODEBUGGER");} virtual void disasm(unsigned int /*address*/, char *dest, int max_size) {strcpy(dest, "NODEBUGGER");}
virtual void getRawMemoryString(unsigned int /*address*/, char *dest, int max_size) {strcpy(dest, "NODEBUGGER");} virtual void getRawMemoryString(unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");}
virtual int getInstructionSize(int /*instruction*/) {return 1;} virtual int getInstructionSize(int /*instruction*/) {return 1;}
virtual bool isAlive() {return true;} virtual bool isAlive() {return true;}

View File

@ -172,7 +172,7 @@ int Sync()
} }
} }
} }
if (PowerPC::ppcState.cr != state.cr) if (GetCR() != state.cr)
{ {
LOG(GEKKO, "DIFFERENCE - CR (local %08x, remote %08x)", PowerPC::ppcState.cr, state.cr); LOG(GEKKO, "DIFFERENCE - CR (local %08x, remote %08x)", PowerPC::ppcState.cr, state.cr);
difference = true; difference = true;

View File

@ -23,33 +23,30 @@ namespace Interpreter
void Helper_UpdateCR0(u32 _uValue) void Helper_UpdateCR0(u32 _uValue)
{ {
u32 Flags = 0; u32 new_cr0;
int sValue = (int)_uValue; int sValue = (int)_uValue;
if (sValue > 0) if (sValue > 0)
Flags |= 0x40000000; new_cr0 = 0x4;
else if (sValue < 0) else if (sValue < 0)
Flags |= 0x80000000; new_cr0 = 0x8;
else else
Flags |= 0x20000000; new_cr0 = 0x2;
Flags |= PowerPC::ppcState.spr[SPR_XER*4] & 0x10000000; new_cr0 |= GetXER_SO();
PowerPC::ppcState.cr = (PowerPC::ppcState.cr & 0xFFFFFFF) | Flags; SetCRField(0, new_cr0);
} }
void Helper_UpdateCRx(int _x, u32 _uValue) void Helper_UpdateCRx(int _x, u32 _uValue)
{ {
int shiftamount = _x*4; u32 new_crX;
int crmask = 0xFFFFFFFF ^ (0xF0000000 >> shiftamount);
u32 Flags = 0;
int sValue = (int)_uValue; int sValue = (int)_uValue;
if (sValue > 0) if (sValue > 0)
Flags |= 0x40000000; new_crX = 0x4;
else if (sValue < 0) else if (sValue < 0)
Flags |= 0x80000000; new_crX = 0x8;
else else
Flags |= 0x20000000; new_crX = 0x2;
Flags |= PowerPC::ppcState.spr[SPR_XER*4] & 0x10000000; new_crX |= GetXER_SO();
PowerPC::ppcState.cr = (PowerPC::ppcState.cr & crmask) | (Flags >> shiftamount); SetCRField(_x, new_crX);
} }
u32 Helper_Carry(u32 _uValue1, u32 _uValue2) u32 Helper_Carry(u32 _uValue1, u32 _uValue2)

View File

@ -160,6 +160,7 @@ namespace Jit64
void mfcr(UGeckoInstruction inst) void mfcr(UGeckoInstruction inst)
{ {
// USES_CR
int d = inst.RD; int d = inst.RD;
gpr.LoadToX64(d, false, true); gpr.LoadToX64(d, false, true);
MOV(32, gpr.R(d), M(&PowerPC::ppcState.cr)); MOV(32, gpr.R(d), M(&PowerPC::ppcState.cr));
@ -167,6 +168,7 @@ namespace Jit64
void mtcrf(UGeckoInstruction inst) void mtcrf(UGeckoInstruction inst)
{ {
// USES_CR
u32 mask = 0; u32 mask = 0;
u32 crm = inst.CRM; u32 crm = inst.CRM;
gpr.FlushLockX(ECX); gpr.FlushLockX(ECX);

View File

@ -97,7 +97,7 @@ int SyncTrace()
} }
}*/ }*/
/* /*
if (PowerPC::ppcState.cr != state.cr) if (GetCR() != state.cr)
{ {
LOG(GEKKO, "DIFFERENCE - CR (local %08x, remote %08x)", PowerPC::ppcState.cr, state.cr); LOG(GEKKO, "DIFFERENCE - CR (local %08x, remote %08x)", PowerPC::ppcState.cr, state.cr);
difference = true; difference = true;