From 56e41e3915399250789d5f7f35cf971afa765413 Mon Sep 17 00:00:00 2001 From: Ry Date: Sun, 18 Sep 2022 18:22:40 -0700 Subject: [PATCH] Ensure the MMU gets re-enabled if we fail to read an interrupt vector --- src/cpu.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpu.rs b/src/cpu.rs index cfd524e..1a84529 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -264,6 +264,7 @@ impl Cpu { *self.bus.memory.mmu_enabled() = false; let address_maybe = self.bus.memory.read_32(address_of_pointer); if address_maybe == None { + *self.bus.memory.mmu_enabled() = old_mmu_state; return; } let address = address_maybe.unwrap(); @@ -292,6 +293,7 @@ impl Cpu { *self.bus.memory.mmu_enabled() = false; let address_maybe = self.bus.memory.read_32(address_of_pointer); if address_maybe == None { + *self.bus.memory.mmu_enabled() = old_mmu_state; return; } let address = address_maybe.unwrap();