Remove delay slot table

This commit is contained in:
zilmar 2012-10-01 13:49:31 +10:00
parent 977631bfd8
commit 95e2b17796
3 changed files with 1 additions and 35 deletions

View File

@ -2,8 +2,7 @@
CFunctionMap::CFunctionMap() :
m_JumpTable(NULL),
m_FunctionTable(NULL),
m_DelaySlotTable(NULL)
m_FunctionTable(NULL)
{
}
@ -26,16 +25,6 @@ bool CFunctionMap::AllocateMemory()
}
memset(m_FunctionTable,0,0xFFFFF * sizeof(CCompiledFunc *));
}
if (m_DelaySlotTable == NULL)
{
m_DelaySlotTable = (BYTE **)VirtualAlloc(NULL,0xFFFFF * sizeof(BYTE *),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
if (m_DelaySlotTable == NULL) {
WriteTrace(TraceError,"CFunctionMap::AllocateMemory: failed to allocate delay slot table");
_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
return false;
}
memset(m_DelaySlotTable,0,0xFFFFF * sizeof(BYTE *));
}
}
if (_Recompiler->LookUpMode() == FuncFind_PhysicalLookup)
{
@ -46,14 +35,6 @@ bool CFunctionMap::AllocateMemory()
return false;
}
memset(m_JumpTable,0,(_MMU->RdramSize() >> 2) * sizeof(PCCompiledFunc));
m_DelaySlotTable = (BYTE **)VirtualAlloc(NULL,(_MMU->RdramSize() >> 0xC) * sizeof(BYTE *),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
if (m_DelaySlotTable == NULL) {
WriteTrace(TraceError,"CFunctionMap::AllocateMemory: failed to allocate delay slot table");
_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
return false;
}
memset(m_DelaySlotTable,0,(_MMU->RdramSize() >> 0xC) * sizeof(BYTE *));
}
return true;
}
@ -72,11 +53,6 @@ void CFunctionMap::CleanBuffers ( void )
VirtualFree( m_FunctionTable, 0 , MEM_RELEASE);
m_FunctionTable = NULL;
}
if (m_DelaySlotTable)
{
VirtualFree( m_DelaySlotTable, 0 , MEM_RELEASE);
m_DelaySlotTable = NULL;
}
if (m_JumpTable)
{
delete [] m_JumpTable;

View File

@ -13,12 +13,10 @@ protected:
public:
inline PCCompiledFunc_TABLE * FunctionTable ( void ) const { return m_FunctionTable; }
inline PCCompiledFunc * JumpTable ( void ) const { return m_JumpTable; }
inline BYTE ** DelaySlotTable ( void ) const { return m_DelaySlotTable; }
private:
void CleanBuffers ( void );
PCCompiledFunc * m_JumpTable;
PCCompiledFunc_TABLE * m_FunctionTable;
BYTE ** m_DelaySlotTable;
};

View File

@ -915,14 +915,6 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R
bool bUnProtect = false;
length = ((length + 3) & ~0x3);
BYTE ** DelaySlotFuncs = DelaySlotTable();
if (WriteStart == 0 && DelaySlotFuncs[AddressIndex] != NULL)
{
DelaySlotFuncs[AddressIndex] = NULL;
_MMU->UnProtectMemory(Address,Address+ 4);
}
int DataInBlock = 0x1000 - WriteStart;
int DataToWrite = length < DataInBlock ? length : DataInBlock;
int DataLeft = length - DataToWrite;