Refracted and cleaned up code related to tlb read/write miss

This commit is contained in:
zilmar 2012-09-29 17:58:16 +10:00
parent 249d2a33f1
commit 322c85802b
16 changed files with 108 additions and 61 deletions

View File

@ -293,7 +293,7 @@ void CInterpreterCPU::ExecuteCPU (void )
_Notify->BreakPoint(__FILE__,__LINE__);
}
} else {
_Reg->DoTLBMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
R4300iOp::m_NextInstruction = NORMAL;
}
}
@ -398,7 +398,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
_Notify->BreakPoint(__FILE__,__LINE__);
}
} else {
_Reg->DoTLBMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
R4300iOp::m_NextInstruction = NORMAL;
}
}

View File

@ -20,7 +20,7 @@ int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
}
#define TLB_READ_EXCEPTION(Address) \
_Reg->DoTLBMiss(m_NextInstruction == JUMP,Address);\
_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
m_NextInstruction = JUMP;\
m_JumpToLocation = (*_PROGRAM_COUNTER);\
return;
@ -865,6 +865,7 @@ void R4300iOp32::LWL (void) {
if (!_MMU->LW_VAddr((Address & ~3),Value))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("LWL TLB: %X",Address);
@ -932,6 +933,7 @@ void R4300iOp32::LWR (void) {
if (!_MMU->LW_VAddr((Address & ~3),Value))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("LWR TLB: %X",Address);

View File

@ -72,7 +72,7 @@ const int R4300iOp::LWR_SHIFT[4] = { 24, 16 ,8, 0 };
}
#define TLB_READ_EXCEPTION(Address) \
_Reg->DoTLBMiss(m_NextInstruction == JUMP,Address);\
_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
m_NextInstruction = JUMP;\
m_JumpToLocation = (*_PROGRAM_COUNTER);\
return;
@ -958,6 +958,7 @@ void R4300iOp::LDL (void) {
if (!_MMU->LD_VAddr((Address & ~7),Value))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("LDL TLB: %X",Address);
@ -983,6 +984,7 @@ void R4300iOp::LDR (void) {
if (!_MMU->LD_VAddr((Address & ~7),Value))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("LDR TLB: %X",Address);
@ -1031,6 +1033,7 @@ void R4300iOp::LWL (void) {
if (!_MMU->LW_VAddr((Address & ~3),Value))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("LWL TLB: %X",Address);
@ -1098,6 +1101,7 @@ void R4300iOp::LWR (void) {
if (!_MMU->LW_VAddr((Address & ~3),Value))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("LWR TLB: %X",Address);
@ -1127,6 +1131,7 @@ void R4300iOp::LWU (void) {
void R4300iOp::SB (void) {
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
if (!_MMU->SB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SB TLB: %X",Address);
#endif
@ -1137,6 +1142,7 @@ void R4300iOp::SH (void) {
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
if ((Address & 1) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
if (!_MMU->SH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SH TLB: %X",Address);
#endif
@ -1153,6 +1159,7 @@ void R4300iOp::SWL (void) {
#ifndef EXTERNAL_RELEASE
DisplayError("SWL TLB: %X",Address);
#endif
_Notify->BreakPoint(__FILE__,__LINE__);
return;
}
@ -1163,6 +1170,7 @@ void R4300iOp::SWL (void) {
#ifndef EXTERNAL_RELEASE
DisplayError("SWL TLB: %X",Address);
#endif
_Notify->BreakPoint(__FILE__,__LINE__);
}
}
@ -1178,6 +1186,7 @@ void R4300iOp::SW (void) {
#endif
if (!_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("SW TLB: %X",Address);
@ -1203,6 +1212,7 @@ void R4300iOp::SDL (void) {
Offset = Address & 7;
if (!_MMU->LD_VAddr((Address & ~7),Value)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SDL TLB: %X",Address);
#endif
@ -1213,6 +1223,7 @@ void R4300iOp::SDL (void) {
Value += _GPR[m_Opcode.rt].UDW >> SDL_SHIFT[Offset];
if (!_MMU->SD_VAddr((Address & ~7),Value)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SDL TLB: %X",Address);
#endif
@ -1238,6 +1249,7 @@ void R4300iOp::SDR (void) {
Offset = Address & 7;
if (!_MMU->LD_VAddr((Address & ~7),Value)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SDL TLB: %X",Address);
#endif
@ -1248,6 +1260,7 @@ void R4300iOp::SDR (void) {
Value += _GPR[m_Opcode.rt].UDW << SDR_SHIFT[Offset];
if (!_MMU->SD_VAddr((Address & ~7),Value)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SDL TLB: %X",Address);
#endif
@ -1261,6 +1274,7 @@ void R4300iOp::SWR (void) {
Offset = Address & 3;
if (!_MMU->LW_VAddr((Address & ~3),Value)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SWL TLB: %X",Address);
#endif
@ -1271,6 +1285,7 @@ void R4300iOp::SWR (void) {
Value += _GPR[m_Opcode.rt].UW[0] << SWR_SHIFT[Offset];
if (!_MMU->SW_VAddr((Address & ~0x03),Value)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SWL TLB: %X",Address);
#endif
@ -1323,6 +1338,7 @@ void R4300iOp::SC (void) {
if ((*_LLBit) == 1) {
if (!_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
{
_Notify->BreakPoint(__FILE__,__LINE__);
if (bShowTLBMisses())
{
DisplayError("SC TLB: %X",Address);
@ -1336,6 +1352,7 @@ void R4300iOp::LD (void) {
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
if (!_MMU->LD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("LD TLB: %X",Address);
#endif
@ -1354,6 +1371,7 @@ void R4300iOp::LDC1 (void) {
TEST_COP1_USABLE_EXCEPTION
if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
if (!_MMU->LD_VAddr(Address,*(unsigned __int64 *)_FPR_D[m_Opcode.ft])) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("LD TLB: %X",Address);
#endif
@ -1366,6 +1384,7 @@ void R4300iOp::SWC1 (void) {
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
if (!_MMU->SW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SWC1 TLB: %X",Address);
#endif
@ -1378,6 +1397,7 @@ void R4300iOp::SDC1 (void) {
TEST_COP1_USABLE_EXCEPTION
if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
if (!_MMU->SD_VAddr(Address,*(__int64 *)_FPR_D[m_Opcode.ft])) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SDC1 TLB: %X",Address);
#endif
@ -1388,6 +1408,7 @@ void R4300iOp::SD (void) {
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
if (!_MMU->SD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifndef EXTERNAL_RELEASE
DisplayError("SD TLB: %X",Address);
#endif

View File

@ -1300,7 +1300,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
{
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION)
{
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
@ -1310,6 +1310,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
DWORD MemAddress = (char *)lpEP->ExceptionRecord->ExceptionInformation[1] - (char *)_MMU->Rdram();
if ((int)(MemAddress) < 0 || MemAddress > 0x1FFFFFFF)
{
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
@ -1322,10 +1323,11 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
DWORD Start, End;
Start = (lpEP->ContextRecord->Edi - (DWORD)m_RDRAM);
End = (Start + (lpEP->ContextRecord->Ecx << 2) - 1);
if ((int)Start < 0) {
#ifndef EXTERNAL_RELEASE
DisplayError("hmmm.... where does this dma start ?");
#endif
if ((int)Start < 0)
{
if (bHaveDebugger()) {
_Notify->BreakPoint(__FILE__,__LINE__);
}
return EXCEPTION_EXECUTE_HANDLER;
}
#ifdef CFB_READ
@ -1350,7 +1352,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
_Recompiler->ClearRecompCode_Phys(Start & ~0xFFF,0x1000,CRecompiler::Remove_ProtectedMem);
return EXCEPTION_CONTINUE_EXECUTION;
}
DisplayError("hmmm.... where does this dma End ?\nstart: %X\nend:%X\nlocation %X", Start,End,lpEP->ContextRecord->Eip);
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
@ -1415,8 +1417,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
case 0x86: ReadPos += 5; break;
case 0x87: ReadPos += 5; break;
default:
DisplayError("Unknown x86 opcode %X\nlocation %X\nloc: %X\nfgh2",
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM);
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
@ -1464,8 +1465,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
return EXCEPTION_CONTINUE_EXECUTION;
default:
DisplayError("Unkown x86 opcode %X\nlocation %X\nloc: %X\nfhfgh2",
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM);
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
break;
@ -1491,7 +1491,11 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
return EXCEPTION_CONTINUE_EXECUTION;
case 0xC7:
if (Reg != &lpEP->ContextRecord->Eax) { return EXCEPTION_EXECUTE_HANDLER; }
if (Reg != &lpEP->ContextRecord->Eax)
{
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
if (!SH_NonMemory(MemAddress,*(WORD *)ReadPos)) {
if (_Settings->LoadDword(Debugger_ShowUnhandledMemory)) {
DisplayError("Failed to store half word\n\nMIPS Address: %X\nX86 Address",MemAddress,
@ -1501,8 +1505,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 2);
return EXCEPTION_CONTINUE_EXECUTION;
default:
DisplayError("Unkown x86 opcode %X\nlocation %X\nloc: %X\nfhfgh2",
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM);
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
break;
@ -1546,7 +1549,11 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
return EXCEPTION_CONTINUE_EXECUTION;
case 0xC6:
if (Reg != &lpEP->ContextRecord->Eax) { return EXCEPTION_EXECUTE_HANDLER; }
if (Reg != &lpEP->ContextRecord->Eax)
{
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
if (!SB_NonMemory(MemAddress,*(BYTE *)ReadPos)) {
if (_Settings->LoadDword(Debugger_ShowUnhandledMemory)) {
DisplayError("Failed to store byte\n\nMIPS Address: %X\nX86 Address",MemAddress,
@ -1556,7 +1563,11 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 1);
return EXCEPTION_CONTINUE_EXECUTION;
case 0xC7:
if (Reg != &lpEP->ContextRecord->Eax) { return EXCEPTION_EXECUTE_HANDLER; }
if (Reg != &lpEP->ContextRecord->Eax)
{
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
if (!SW_NonMemory(MemAddress,*(DWORD *)ReadPos)) {
if (_Settings->LoadDword(Debugger_ShowUnhandledMemory)) {
DisplayError("Failed to store word\n\nMIPS Address: %X\nX86 Address",MemAddress,
@ -1566,10 +1577,10 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 4);
return EXCEPTION_CONTINUE_EXECUTION;
default:
DisplayError("Unkown x86 opcode %X\nlocation %X\nloc: %X\nfhfgh2",
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM);
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}
if (bHaveDebugger()) { _Notify->BreakPoint(__FILE__,__LINE__); }
return EXCEPTION_EXECUTE_HANDLER;
}

View File

@ -403,7 +403,7 @@ BOOL CRegisters::DoIntrException ( BOOL DelaySlot )
return TRUE;
}
void CRegisters::DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr )
void CRegisters::DoTLBReadMiss ( BOOL DelaySlot, DWORD BadVaddr )
{
CAUSE_REGISTER = EXC_RMISS;
BAD_VADDR_REGISTER = BadVaddr;

View File

@ -512,7 +512,7 @@ public:
void DoBreakException ( BOOL DelaySlot );
void DoCopUnusableException ( BOOL DelaySlot, int Coprocessor );
BOOL DoIntrException ( BOOL DelaySlot );
void DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr );
void DoTLBReadMiss ( BOOL DelaySlot, DWORD BadVaddr );
void DoSysCallException ( BOOL DelaySlot);
void FixFpuLocations ( void );
void Reset ( void );

View File

@ -47,7 +47,9 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
m_CPU_ThreadID(0),
m_TestTimer(false),
m_NextInstruction(0),
m_JumpToLocation(0)
m_JumpToLocation(0),
m_TLBLoadAddress(0),
m_TLBStoreAddress(0)
{
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
m_Limitor.SetHertz(_Settings->LoadDword(Game_ScreenHertz));
@ -545,6 +547,8 @@ bool CN64System::SetActiveSystem( bool bActive )
_SystemEvents = this;
_NextTimer = &m_NextTimer;
_Plugins = m_Plugins;
_TLBLoadAddress = &m_TLBLoadAddress;
_TLBStoreAddress = &m_TLBStoreAddress;
R4300iOp::m_TestTimer = m_TestTimer;
R4300iOp::m_NextInstruction = m_NextInstruction;
R4300iOp::m_JumpToLocation = m_JumpToLocation;
@ -562,19 +566,21 @@ bool CN64System::SetActiveSystem( bool bActive )
} else {
if (this == _BaseSystem)
{
_System = NULL;
_SyncSystem = NULL;
_Recompiler = NULL;
_MMU = NULL;
_TLB = NULL;
_Reg = NULL;
_Audio = NULL;
_Labels = NULL;
_SystemTimer = NULL;
_TransVaddr = NULL;
_SystemEvents = NULL;
_NextTimer = NULL;
_Plugins = m_Plugins;
_System = NULL;
_SyncSystem = NULL;
_Recompiler = NULL;
_MMU = NULL;
_TLB = NULL;
_Reg = NULL;
_Audio = NULL;
_Labels = NULL;
_SystemTimer = NULL;
_TransVaddr = NULL;
_SystemEvents = NULL;
_NextTimer = NULL;
_Plugins = m_Plugins;
_TLBLoadAddress = NULL;
_TLBStoreAddress = NULL;
}
}

View File

@ -130,7 +130,9 @@ private:
BOOL m_TestTimer;
DWORD m_NextInstruction;
DWORD m_JumpToLocation;
DWORD m_TLBLoadAddress;
DWORD m_TLBStoreAddress;
//When Syncing cores this is the PC where it last Sync'ed correctly
DWORD m_LastSuccessSyncPC[10];
int m_CyclesToSkip;

View File

@ -127,7 +127,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
if (TargetPC != (DWORD)-1)
{
MoveConstToVariable(TargetPC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
UpdateCounters(ExitRegSet,TargetPC <= JumpPC, reason == CExitInfo::Normal);
UpdateCounters(ExitRegSet,TargetPC <= JumpPC && JumpPC != -1, reason == CExitInfo::Normal);
} else {
UpdateCounters(ExitRegSet,false,reason == CExitInfo::Normal);
}
@ -282,14 +282,13 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
ExitCodeBlock();
break;
case CExitInfo::TLBReadMiss:
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
MoveConstToX86reg(m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT,x86_ECX);
MoveVariableToX86reg(&TLBLoadAddress,"TLBLoadAddress",x86_EDX);
Call_Direct(DoTLBMiss,"DoTLBMiss");
MoveVariableToX86reg(_TLBLoadAddress,"_TLBLoadAddress",x86_EDX);
Push(x86_EDX);
PushImm32(m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT);
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoTLBReadMiss),"CRegisters::DoTLBReadMiss");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
Ret();
#endif
ExitCodeBlock();
break;
default:
DisplayError("how did you want to exit on reason (%d) ???",reason);

View File

@ -85,7 +85,7 @@ void CRecompiler::RecompilerMain_VirtualTable ( void )
{
if (!_TransVaddr->ValidVaddr(PC))
{
_Reg->DoTLBMiss(false,PC);
_Reg->DoTLBReadMiss(false,PC);
if (!_TransVaddr->ValidVaddr(PC))
{
DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PC);
@ -504,7 +504,7 @@ void CRecompiler::RecompilerMain_Lookup_TLB( void )
{
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
{
_Reg->DoTLBMiss(false,PROGRAM_COUNTER);
_Reg->DoTLBReadMiss(false,PROGRAM_COUNTER);
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
{
DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);
@ -604,7 +604,7 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB( void )
{
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
{
_Reg->DoTLBMiss(false,PROGRAM_COUNTER);
_Reg->DoTLBReadMiss(false,PROGRAM_COUNTER);
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
{
DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);

View File

@ -7,22 +7,18 @@ DWORD CRecompilerOps::m_CompilePC;
OPCODE CRecompilerOps::m_Opcode;
DWORD CRecompilerOps::m_BranchCompare = 0;
void CRecompilerOps::CompileReadTLBMiss (int AddressReg, int LookUpReg )
void CRecompilerOps::CompileReadTLBMiss (x86Reg AddressReg, x86Reg LookUpReg )
{
#ifdef tofix
MoveX86regToVariable(AddressReg,&TLBLoadAddress,"TLBLoadAddress");
MoveX86regToVariable(AddressReg,_TLBLoadAddress,"TLBLoadAddress");
TestX86RegToX86Reg(LookUpReg,LookUpReg);
m_Section->CompileExit(m_CompilePC, m_CompilePC,m_RegWorkingSet,CExitInfo::TLBReadMiss,FALSE,JeLabel32);
#endif
}
void CRecompilerOps::CompileWriteTLBMiss (int AddressReg, int LookUpReg )
void CRecompilerOps::CompileWriteTLBMiss (x86Reg AddressReg, x86Reg LookUpReg )
{
#ifdef tofix
MoveX86regToVariable(AddressReg,&TLBStoreAddress,"TLBStoreAddress");
MoveX86regToVariable(AddressReg,&_TLBStoreAddress,"_TLBStoreAddress");
TestX86RegToX86Reg(LookUpReg,LookUpReg);
m_Section->CompileExit(m_CompilePC, m_CompilePC,m_RegWorkingSet,CExitInfo::TLBReadMiss,FALSE,JeLabel32);
#endif
m_Section->CompileExit(m_CompilePC, m_CompilePC,m_RegWorkingSet,CExitInfo::TLBWriteMiss,FALSE,JeLabel32);
}
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );

View File

@ -189,8 +189,8 @@ protected:
static void AfterCallDirect ( CRegInfo & RegSet );
static void EnterCodeBlock ( void );
static void ExitCodeBlock ( void );
static void CompileReadTLBMiss (int AddressReg, int LookUpReg );
static void CompileWriteTLBMiss (int AddressReg, int LookUpReg );
static void CompileReadTLBMiss (x86Reg AddressReg, x86Reg LookUpReg );
static void CompileWriteTLBMiss (x86Reg AddressReg, x86Reg LookUpReg );
static void UpdateSyncCPU (CRegInfo & RegSet, DWORD Cycles);
static void UpdateCounters (CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false );
static void CompileSystemCheck ( DWORD TargetPC, CRegInfo RegSet );

View File

@ -2150,6 +2150,11 @@ void CX86Ops::Pop(x86Reg reg) {
}
}
void CX86Ops::PushImm32(DWORD Value)
{
PushImm32(stdstr_f("%d",Value).c_str(),Value);
}
void CX86Ops::PushImm32(const char * String, DWORD Value) {
CPU_Message(" push %s",String);
PUTDST8(m_RecompPos,0x68);

View File

@ -171,6 +171,7 @@ protected:
static void OrX86RegToX86Reg ( x86Reg Destination, x86Reg Source );
static void Push ( x86Reg reg );
static void Pushad ( void );
static void PushImm32 ( DWORD Value );
static void PushImm32 ( const char * String, DWORD Value );
static void Pop ( x86Reg reg );
static void Popad ( void );

View File

@ -15,6 +15,8 @@ CMemoryLabel * _Labels = NULL;
CSystemTimer * _SystemTimer = NULL;
CTransVaddr * _TransVaddr = NULL;
CSystemEvents * _SystemEvents = NULL;
DWORD * _TLBLoadAddress = NULL;
DWORD * _TLBStoreAddress = NULL;
int * _NextTimer;

View File

@ -15,4 +15,6 @@ extern CMemoryLabel * _Labels;
extern CSystemTimer * _SystemTimer;
extern CTransVaddr * _TransVaddr;
extern CSystemEvents * _SystemEvents;
extern int * _NextTimer;
extern int * _NextTimer;
extern DWORD * _TLBLoadAddress;
extern DWORD * _TLBStoreAddress;