CPU/CodeCache: Fix incorrect invalidation on non-page-crossing DMA writes

Fixes recompiler mode for Breath of Fire III, probably others.
This commit is contained in:
Connor McLaughlin 2020-10-29 01:29:56 +10:00
parent 451c48406d
commit a8171405b1
1 changed files with 2 additions and 2 deletions

View File

@ -130,8 +130,8 @@ void InterpretUncachedBlock();
ALWAYS_INLINE void InvalidateCodePages(PhysicalMemoryAddress address, u32 word_count) ALWAYS_INLINE void InvalidateCodePages(PhysicalMemoryAddress address, u32 word_count)
{ {
const u32 start_page = address / CPU_CODE_CACHE_PAGE_SIZE; const u32 start_page = address / CPU_CODE_CACHE_PAGE_SIZE;
const u32 end_page = (address + word_count * sizeof(u32)) / CPU_CODE_CACHE_PAGE_SIZE; const u32 end_page = (address + word_count * sizeof(u32) - sizeof(u32)) / CPU_CODE_CACHE_PAGE_SIZE;
for (u32 page = start_page; page < end_page; page++) for (u32 page = start_page; page <= end_page; page++)
{ {
if (Bus::m_ram_code_bits[page]) if (Bus::m_ram_code_bits[page])
CPU::CodeCache::InvalidateBlocksWithPageIndex(page); CPU::CodeCache::InvalidateBlocksWithPageIndex(page);