Core: Improve StoreInstruc

This commit is contained in:
zilmar 2023-01-09 14:26:35 +10:30
parent ccae22afc5
commit 531a7df959
3 changed files with 15 additions and 7 deletions

View File

@ -206,7 +206,8 @@ void PeripheralInterfaceHandler::OnFirstDMA()
g_Notify->DisplayError(stdstr_f("Unhandled CicChip(%d) in first DMA", g_Rom->CicChipID()).c_str());
return;
}
m_MMU.UpdateMemoryValue32(0x80000000 + offset, m_MMU.RdramSize());
m_MMU.SW_Memory(0xFFFFFFFF80000000 + offset, m_MMU.RdramSize());
}
void PeripheralInterfaceHandler::PI_DMA_READ()
@ -377,6 +378,11 @@ void PeripheralInterfaceHandler::PI_DMA_WRITE()
else
{
int32_t Length = PI_WR_LEN_REG + 1;
if (g_Recompiler && bSMM_PIDMA())
{
g_Recompiler->ClearRecompCode_Phys(WritePos & ~0xFFF, Length, CRecompiler::Remove_DMA);
}
PI_WR_LEN_REG = Length <= 8 ? 0x7F - (PI_DRAM_ADDR_REG & 7) : 0x7F;
uint8_t Block[128];
@ -468,10 +474,6 @@ void PeripheralInterfaceHandler::PI_DMA_WRITE()
MI_INTR_REG |= MI_INTR_PI;
m_Reg.CheckInterrupts();
}
if (g_Recompiler && g_System->bSMM_PIDMA())
{
g_Recompiler->ClearRecompCode_Phys(WritePos, Length, CRecompiler::Remove_DMA);
}
}
}

View File

@ -862,7 +862,8 @@ bool CMipsMemoryVM::SW_NonMemory(uint32_t VAddr, uint32_t Value)
}
if (CGameSettings::bSMM_StoreInstruc())
{
m_TLB_WriteMap[VAddr >> 12] = PAddr - VAddr;
m_TLB_WriteMap[(0x80000000 + PAddr) >> 12] = PAddr - VAddr;
m_TLB_WriteMap[(0xA0000000 + PAddr) >> 12] = PAddr - VAddr;
}
*(uint32_t *)(m_RDRAM + PAddr) = Value;
}
@ -950,7 +951,7 @@ void CMipsMemoryVM::ClearMemoryWriteMap(uint32_t VAddr, uint32_t Length)
return;
}
uint32_t PAddr = m_TLB_ReadMap[VAddr >> 12] + VAddr;
for (uint32_t i = PAddr, n = (PAddr + Length) + 0x1000; i < n; i += 0x1000)
for (uint32_t i = PAddr, n = (PAddr + (Length & ~0xFFF)) + 0x1000; i < n; i += 0x1000)
{
m_MemoryWriteMap[(i + 0x80000000) >> 12] = (size_t)-1;
m_MemoryWriteMap[(i + 0xA0000000) >> 12] = (size_t)-1;

View File

@ -389,6 +389,11 @@ CCompiledFunc * CRecompiler::CompileCode()
*g_RecompPos += CodeLen;
LogCodeBlock(CodeBlock);
if (bSMM_StoreInstruc())
{
m_MMU.ClearMemoryWriteMap(CodeBlock.VAddrEnter() & ~0xFFF, 0xFFF);
}
CCompiledFunc * Func = new CCompiledFunc(CodeBlock);
std::pair<CCompiledFuncList::iterator, bool> ret = m_Functions.insert(CCompiledFuncList::value_type(Func->EnterPC(), Func));
if (ret.second == false)