diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index d29a364c4..0e650837e 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -689,7 +689,16 @@ void CPU::CodeCache::InvalidateAllRAMBlocks() for (Block* block : s_blocks) { if (AddressInRAM(block->pc)) + { InvalidateBlock(block, BlockState::Invalidated); + block->next_block_in_page = nullptr; + } + } + + for (PageProtectionInfo& ppi : s_page_protection) + { + ppi.first_block_in_page = nullptr; + ppi.last_block_in_page = nullptr; } MemMap::EndCodeWrite();