From e2163296551220f06a86b85380d671fc3061b12e Mon Sep 17 00:00:00 2001 From: Galen Williamson Date: Mon, 28 Apr 2025 12:31:16 -0400 Subject: [thumb2] correctly set flags for mov{s} and mvn{s} instruction variants with 32-bit encodings, addresses #6698 --- arch/armv7/thumb2_disasm/il_thumb2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/armv7/thumb2_disasm/il_thumb2.cpp b/arch/armv7/thumb2_disasm/il_thumb2.cpp index d62f1477..d98b54d2 100644 --- a/arch/armv7/thumb2_disasm/il_thumb2.cpp +++ b/arch/armv7/thumb2_disasm/il_thumb2.cpp @@ -981,7 +981,8 @@ bool GetLowLevelILForThumbInstruction(Architecture* arch, LowLevelILFunction& il break; case armv7::ARMV7_MOV: case armv7::ARMV7_MOVW: - il.AddInstruction(WriteILOperand(il, instr, 0, ReadILOperand(il, instr, 1))); + il.AddInstruction(WriteILOperand(il, instr, 0, ReadILOperand(il, instr, 1), 4, + WritesToStatus(instr, ifThenBlock) ? IL_FLAGWRITE_NZ : 0)); break; case armv7::ARMV7_MOVS: il.AddInstruction(WriteILOperand(il, instr, 0, ReadILOperand(il, instr, 1), 4, @@ -1034,7 +1035,8 @@ bool GetLowLevelILForThumbInstruction(Architecture* arch, LowLevelILFunction& il ReadArithOperand(il, instr, 1), ifThenBlock ? 0 : IL_FLAGWRITE_NZ))); break; case armv7::ARMV7_MVN: - il.AddInstruction(WriteILOperand(il, instr, 0, il.Not(4, ReadArithOperand(il, instr, 1)))); + il.AddInstruction(WriteILOperand(il, instr, 0, il.Not(4, ReadArithOperand(il, instr, 1), + WritesToStatus(instr, ifThenBlock) ? IL_FLAGWRITE_ALL : 0))); break; case armv7::ARMV7_MVNS: il.AddInstruction(WriteILOperand(il, instr, 0, il.Not(4, ReadArithOperand(il, instr, 1), ifThenBlock ? 0 : IL_FLAGWRITE_ALL))); -- cgit v1.3.1