Global Variable: rename _TLB to g_TLB

This commit is contained in:
zilmar 2012-11-17 13:16:38 +11:00
parent 7212599e24
commit c219c0ab6a
9 changed files with 28 additions and 28 deletions

View File

@ -104,7 +104,7 @@ void CDebugTlb::RefreshTLBWindow (void)
LV_ITEM item, OldItem;
int count;
CTLB::TLB_ENTRY * tlb = _TLB->m_tlb;
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
for (count = 0; count < 32; count ++) {
sprintf(Output,"0x%02X",count);
item.mask = LVIF_TEXT;
@ -175,7 +175,7 @@ void CDebugTlb::RefreshTLBWindow (void)
}
}
CTLB::FASTTLB * FastTlb = _TLB->m_FastTlb;
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
hList = GetDlgItem(IDC_LIST2);
for (count = 0; count < 64; count ++) {
sprintf(Output,"0x%02X",count);

View File

@ -21,7 +21,7 @@ public:
//class CDebugTlb
//{
// CTLB * _TLB;
// CTLB * g_TLB;
//
// //Debugger
// WND_HANDLE m_hDebugWnd;
@ -30,7 +30,7 @@ public:
// friend DWORD CALLBACK DebugWndProc ( WND_HANDLE, DWORD, DWORD, DWORD );
//
//public:
// CDebugTlb(CTLB * _TLB);
// CDebugTlb(CTLB * g_TLB);
// ~CDebugTlb(void);
//
// //debugger function

View File

@ -1867,22 +1867,22 @@ void R4300iOp::COP0_MT (void) {
/************************** COP0 CO functions ***********************/
void R4300iOp::COP0_CO_TLBR (void) {
if (!bUseTlb()) { return; }
_TLB->ReadEntry();
g_TLB->ReadEntry();
}
void R4300iOp::COP0_CO_TLBWI (void) {
if (!bUseTlb()) { return; }
_TLB->WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
g_TLB->WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
}
void R4300iOp::COP0_CO_TLBWR (void) {
if (!bUseTlb()) { return; }
_TLB->WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,true);
g_TLB->WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,true);
}
void R4300iOp::COP0_CO_TLBP (void) {
if (!bUseTlb()) { return; }
_TLB->Probe();
g_TLB->Probe();
}
void R4300iOp::COP0_CO_ERET (void) {

View File

@ -417,7 +417,7 @@ void CRegisters::DoTLBReadMiss ( BOOL DelaySlot, DWORD BadVaddr )
} else {
EPC_REGISTER = m_PROGRAM_COUNTER;
}
if (_TLB->AddressDefined(BadVaddr))
if (g_TLB->AddressDefined(BadVaddr))
{
m_PROGRAM_COUNTER = 0x80000180;
} else {
@ -426,7 +426,7 @@ void CRegisters::DoTLBReadMiss ( BOOL DelaySlot, DWORD BadVaddr )
STATUS_REGISTER |= STATUS_EXL;
} else {
#ifndef EXTERNAL_RELEASE
g_Notify->DisplayError("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,_TLB->AddressDefined(BadVaddr)?"TRUE":"FALSE");
g_Notify->DisplayError("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,g_TLB->AddressDefined(BadVaddr)?"TRUE":"FALSE");
#endif
m_PROGRAM_COUNTER = 0x80000180;
}

View File

@ -528,7 +528,7 @@ bool CN64System::SetActiveSystem( bool bActive )
}
g_Recompiler = m_Recomp;
g_MMU = &m_MMU_VM;
_TLB = &m_TLB;
g_TLB = &m_TLB;
_Reg = &m_Reg;
_Audio = &m_Audio;
//_Labels = NULL; //???
@ -560,7 +560,7 @@ bool CN64System::SetActiveSystem( bool bActive )
g_SyncSystem = NULL;
g_Recompiler = NULL;
g_MMU = NULL;
_TLB = NULL;
g_TLB = NULL;
_Reg = NULL;
_Audio = NULL;
_Labels = NULL;
@ -1232,7 +1232,7 @@ bool CN64System::SaveState(void)
zipWriteInFileInZip(file,m_Reg.m_Peripheral_Interface,sizeof(DWORD)*13);
zipWriteInFileInZip(file,m_Reg.m_RDRAM_Interface,sizeof(DWORD)*8);
zipWriteInFileInZip(file,m_Reg.m_SerialInterface,sizeof(DWORD)*4);
zipWriteInFileInZip(file,(void *const)&_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32);
zipWriteInFileInZip(file,(void *const)&g_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32);
zipWriteInFileInZip(file,g_MMU->PifRam(),0x40);
zipWriteInFileInZip(file,g_MMU->Rdram(),RdramSize);
zipWriteInFileInZip(file,g_MMU->Dmem(),0x1000);
@ -1276,7 +1276,7 @@ bool CN64System::SaveState(void)
WriteFile( hSaveFile,m_Reg.m_Peripheral_Interface,sizeof(DWORD)*13,&dwWritten,NULL);
WriteFile( hSaveFile,m_Reg.m_RDRAM_Interface,sizeof(DWORD)*8,&dwWritten,NULL);
WriteFile( hSaveFile,m_Reg.m_SerialInterface,sizeof(DWORD)*4,&dwWritten,NULL);
WriteFile( hSaveFile,&_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32,&dwWritten,NULL);
WriteFile( hSaveFile,&g_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32,&dwWritten,NULL);
WriteFile( hSaveFile,g_MMU->PifRam(),0x40,&dwWritten,NULL);
WriteFile( hSaveFile,g_MMU->Rdram(),RdramSize,&dwWritten,NULL);
WriteFile( hSaveFile,g_MMU->Dmem(),0x1000,&dwWritten,NULL);
@ -1412,7 +1412,7 @@ bool CN64System::LoadState(LPCSTR FileName) {
unzReadCurrentFile(file,m_Reg.m_Peripheral_Interface,sizeof(DWORD)*13);
unzReadCurrentFile(file,m_Reg.m_RDRAM_Interface,sizeof(DWORD)*8);
unzReadCurrentFile(file,m_Reg.m_SerialInterface,sizeof(DWORD)*4);
unzReadCurrentFile(file,(void *const)&_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32);
unzReadCurrentFile(file,(void *const)&g_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32);
unzReadCurrentFile(file,m_MMU_VM.PifRam(),0x40);
unzReadCurrentFile(file,m_MMU_VM.Rdram(),SaveRDRAMSize);
unzReadCurrentFile(file,m_MMU_VM.Dmem(),0x1000);
@ -1472,7 +1472,7 @@ bool CN64System::LoadState(LPCSTR FileName) {
ReadFile( hSaveFile,m_Reg.m_Peripheral_Interface,sizeof(DWORD)*13,&dwRead,NULL);
ReadFile( hSaveFile,m_Reg.m_RDRAM_Interface,sizeof(DWORD)*8,&dwRead,NULL);
ReadFile( hSaveFile,m_Reg.m_SerialInterface,sizeof(DWORD)*4,&dwRead,NULL);
ReadFile( hSaveFile,(void *const)&_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32,&dwRead,NULL);
ReadFile( hSaveFile,(void *const)&g_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32,&dwRead,NULL);
ReadFile( hSaveFile,m_MMU_VM.PifRam(),0x40,&dwRead,NULL);
ReadFile( hSaveFile,m_MMU_VM.Rdram(),SaveRDRAMSize,&dwRead,NULL);
ReadFile( hSaveFile,m_MMU_VM.Dmem(),0x1000,&dwRead,NULL);

View File

@ -147,11 +147,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate ( void )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
if (!_TLB->ValidVaddr(PROGRAM_COUNTER))
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER);
NextInstruction = NORMAL;
if (!_TLB->ValidVaddr(PROGRAM_COUNTER))
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);
return;
@ -207,11 +207,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate ( void )
}
g_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
if (!_TLB->ValidVaddr(PROGRAM_COUNTER))
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER);
NextInstruction = NORMAL;
if (!_TLB->ValidVaddr(PROGRAM_COUNTER))
if (!g_TLB->ValidVaddr(PROGRAM_COUNTER))
{
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);
return;
@ -355,7 +355,7 @@ void CRecompiler::RecompilerMain_Lookup( void )
{
g_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
if (!_TLB->TranslateVaddr(PROGRAM_COUNTER, Addr))
if (!g_TLB->TranslateVaddr(PROGRAM_COUNTER, Addr))
{
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER);
NextInstruction = NORMAL;
@ -898,7 +898,7 @@ void CRecompiler::ClearRecompCode_Phys(DWORD Address, int length, REMOVE_REASON
if (bUseTlb())
{
DWORD VAddr, Index = 0;
while (_TLB->PAddrToVAddr(Address,VAddr,Index))
while (g_TLB->PAddrToVAddr(Address,VAddr,Index))
{
WriteTraceF(TraceRecompiler,"ClearRecompCode Vaddr %X len: %d",VAddr,length);
ClearRecompCode_Virt(VAddr,length,Reason);

View File

@ -4152,7 +4152,7 @@ void CRecompilerOps::COP0_CO_TLBR( void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (!bUseTlb()) { return; }
BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
MoveConstToX86reg((DWORD)g_TLB,x86_ECX);
Call_Direct(AddressOf(&CTLB::ReadEntry),"CTLB::ReadEntry");
AfterCallDirect(m_RegWorkingSet);
}
@ -4165,7 +4165,7 @@ void CRecompilerOps::COP0_CO_TLBWI( void) {
MoveVariableToX86reg(&_Reg->INDEX_REGISTER,"INDEX_REGISTER",x86_ECX);
AndConstToX86Reg(x86_ECX,0x1F);
Push(x86_ECX);
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
MoveConstToX86reg((DWORD)g_TLB,x86_ECX);
Call_Direct(AddressOf(&CTLB::WriteEntry),"CTLB::WriteEntry");
AfterCallDirect(m_RegWorkingSet);
}
@ -4185,7 +4185,7 @@ void CRecompilerOps::COP0_CO_TLBWR( void) {
MoveVariableToX86reg(&_Reg->RANDOM_REGISTER,"RANDOM_REGISTER",x86_ECX);
AndConstToX86Reg(x86_ECX,0x1F);
Push(x86_ECX);
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
MoveConstToX86reg((DWORD)g_TLB,x86_ECX);
Call_Direct(AddressOf(&CTLB::WriteEntry),"CTLB::WriteEntry");
AfterCallDirect(m_RegWorkingSet);
}
@ -4195,7 +4195,7 @@ void CRecompilerOps::COP0_CO_TLBP( void) {
if (!bUseTlb()) { return; }
BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
MoveConstToX86reg((DWORD)g_TLB,x86_ECX);
Call_Direct(AddressOf(&CTLB::Probe), "CTLB::TLB_Probe");
AfterCallDirect(m_RegWorkingSet);
}

View File

@ -5,7 +5,7 @@ CN64System * g_BaseSystem = NULL;
CN64System * g_SyncSystem = NULL;
CRecompiler * g_Recompiler = NULL;
CMipsMemory * g_MMU = NULL; //Memory of the n64
CTLB * _TLB = NULL; //TLB Unit
CTLB * g_TLB = NULL; //TLB Unit
CRegisters * _Reg = NULL; //Current Register Set attacted to the g_MMU
CNotification * g_Notify = NULL;
CPlugins * _Plugins = NULL;

View File

@ -6,7 +6,7 @@ extern CN64System * g_BaseSystem;
extern CN64System * g_SyncSystem;
extern CRecompiler * g_Recompiler;
extern CMipsMemory * g_MMU; //Memory of the n64
extern CTLB * _TLB; //TLB Unit
extern CTLB * g_TLB; //TLB Unit
extern CRegisters * _Reg; //Current Register Set attacted to the g_MMU
extern CPlugins * _Plugins;
extern CN64Rom * _Rom; //The current rom that this system is executing.. it can only execute one file at the time