From 92f65794d8b0eef2186b7be45d4a2c0d26e5bd07 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Tue, 9 Jul 2019 02:20:32 +0300 Subject: [PATCH] Fix writeback for Thumb LdmStm Former-commit-id: 00a15dc99716290da7b260b261090454d621ce8a --- src/arm7tdmi/thumb/exec.rs | 2 ++ src/arm7tdmi/thumb/mod.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/arm7tdmi/thumb/exec.rs b/src/arm7tdmi/thumb/exec.rs index 9727f0b..85c608e 100644 --- a/src/arm7tdmi/thumb/exec.rs +++ b/src/arm7tdmi/thumb/exec.rs @@ -375,6 +375,8 @@ impl Core { } } + self.gpr[rb] = addr as u32; + Ok(CpuPipelineAction::IncPC) } diff --git a/src/arm7tdmi/thumb/mod.rs b/src/arm7tdmi/thumb/mod.rs index 84ff609..748c7ca 100644 --- a/src/arm7tdmi/thumb/mod.rs +++ b/src/arm7tdmi/thumb/mod.rs @@ -219,7 +219,10 @@ impl ThumbInstruction { } pub fn rb(&self) -> usize { - self.raw.bit_range(3..6) as usize + match self.fmt { + ThumbFormat::LdmStm => self.raw.bit_range(8..11) as usize, + _ => self.raw.bit_range(3..6) as usize, + } } pub fn ro(&self) -> usize {