From 163d8bda5963fb33a0f97cde92dc1a33c49b1bb4 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Mon, 8 Jul 2019 00:58:09 +0300 Subject: [PATCH] Fix not flushing the pipeline for "mov pc, reg" instructions Former-commit-id: 66136ef70b8f48d5e9f4c10b65f1e2fbd3dd3ea1 --- src/arm7tdmi/thumb/exec.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/arm7tdmi/thumb/exec.rs b/src/arm7tdmi/thumb/exec.rs index c26f50a..bec4dbb 100644 --- a/src/arm7tdmi/thumb/exec.rs +++ b/src/arm7tdmi/thumb/exec.rs @@ -137,6 +137,9 @@ impl Core { let result = self.alu(arm_alu_op, op1, op2, true); if let Some(result) = result { self.set_reg(dst_reg, result as u32); + if dst_reg == REG_PC { + return Ok(CpuPipelineAction::Flush); + } } Ok(CpuPipelineAction::IncPC) }