summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Williamson <galen@vector35.com>2025-04-28 12:31:16 -0400
committerGalen Williamson <galen@vector35.com>2025-04-28 12:31:16 -0400
commite2163296551220f06a86b85380d671fc3061b12e (patch)
tree86ac7be14d110f883c7a27389616c49145630a5d
parent54990215c2ad8bda17de857a7fe97d9a7559364f (diff)
[thumb2] correctly set flags for mov{s} and mvn{s} instruction variants with 32-bit encodings, addresses #6698
-rw-r--r--arch/armv7/thumb2_disasm/il_thumb2.cpp6
1 files 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)));