From 23dff0a9b68d7d343552da92405535b85ebe01f9 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 19 Oct 2023 21:40:01 +1000 Subject: [PATCH] Bus: Properly set unmapped pages to NULL for LUT fastmem --- src/core/bus.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/bus.cpp b/src/core/bus.cpp index 46fa14caf..319c1b652 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -543,7 +543,9 @@ void Bus::UpdateFastmemViews(CPUFastmemMode mode) Log_InfoPrintf("Fastmem base (software): %p", s_fastmem_lut); } - std::memset(s_fastmem_lut, 0, sizeof(u8*) * FASTMEM_LUT_SLOTS); + // This assumes the top 4KB of address space is not mapped. It shouldn't be on any sane OSes. + for (u32 i = 0; i < FASTMEM_LUT_SLOTS; i++) + s_fastmem_lut[i] = GetLUTFastmemPointer(i << FASTMEM_LUT_PAGE_SHIFT, nullptr); auto MapRAM = [](u32 base_address) { u8* ram_ptr = g_ram + (base_address & g_ram_mask);