From 3541779fbf7c92f134b1c44202955a62c2d0edee Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Thu, 4 Jul 2019 01:37:05 +0300 Subject: [PATCH] Fix LR when changing cpu modes Former-commit-id: 0ac911ee90758b9bffaafd459f1d9bca86d5064d --- src/arm7tdmi/cpu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arm7tdmi/cpu.rs b/src/arm7tdmi/cpu.rs index 0c8203b..575e503 100644 --- a/src/arm7tdmi/cpu.rs +++ b/src/arm7tdmi/cpu.rs @@ -134,8 +134,8 @@ impl Core { self.gpr[13] = self.gpr_banked_r13[next_index]; self.gpr_banked_r14[curr_index] = self.gpr[14]; - self.gpr_banked_r14[next_index] = self.pc; // Store the return address in LR_mode self.gpr[14] = self.gpr_banked_r14[next_index]; + self.gpr_banked_r14[next_index] = self.get_next_pc(); // Store the return address in LR_mode if new_mode == CpuMode::Fiq { for r in 0..5 {