From 53c6d74a6b8ed356ed5fd09b0d560e810f1c8299 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 3 Jun 2024 18:01:55 -0600 Subject: [PATCH] Fix addic/addic. handling in relocation tracker Resolves #57 --- src/analysis/vm.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/analysis/vm.rs b/src/analysis/vm.rs index d219988..a84046f 100644 --- a/src/analysis/vm.rs +++ b/src/analysis/vm.rs @@ -257,7 +257,8 @@ impl VM { self.gpr[ins.field_ra() as usize], ); } else { - let left = if ins.field_ra() == 0 && ins.op == Opcode::Addi { + let load_zero = ins.field_ra() == 0 && ins.op == Opcode::Addi; + let left = if load_zero { GprValue::Constant(0) } else { self.gpr[ins.field_ra() as usize].value @@ -271,7 +272,7 @@ impl VM { ), _ => GprValue::Unknown, }; - if ins.field_ra() == 0 { + if load_zero { // li rD, SIMM self.gpr[ins.field_rd() as usize].set_direct(value); } else {