From 00cd9af033cfaffce262dc972170dbec177af3e1 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Sun, 21 Jul 2019 23:56:24 +0200 Subject: fix uninitialised memory mapping --- src/ARM.cpp | 1 - src/CP15.cpp | 2 ++ src/NDS.cpp | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ARM.cpp b/src/ARM.cpp index dd0be6a..50ef8fd 100644 --- a/src/ARM.cpp +++ b/src/ARM.cpp @@ -124,7 +124,6 @@ void ARMv5::Reset() GetMemRegion = NDS::ARM9GetMemRegion; } - CP15Reset(); ARM::Reset(); } diff --git a/src/CP15.cpp b/src/CP15.cpp index 5b5f935..77244f2 100644 --- a/src/CP15.cpp +++ b/src/CP15.cpp @@ -258,9 +258,11 @@ void ARMv5::UpdatePURegions(bool update_all) void ARMv5::UpdateRegionTimings(u32 addrstart, u32 addrend) { + printf("initialising region timings %x %x\n", addrstart, addrend); addrstart >>= 12; addrend >>= 12; + if (addrend == 0xFFFFF) addrend++; for (u32 i = addrstart; i < addrend; i++) diff --git a/src/NDS.cpp b/src/NDS.cpp index 3de9c1f..0bde139 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -501,6 +501,10 @@ void Reset() ARM9ClockShift = 1; MainRAMMask = 0x3FFFFF; } + // has to be called before InitTimings + // otherwise some PU settings are completely + // unitialised on the first run + ARM9->CP15Reset(); ARM9Timestamp = 0; ARM9Target = 0; ARM7Timestamp = 0; ARM7Target = 0; -- cgit v1.2.3