summaryrefslogtreecommitdiff
path: root/arch/arm64/il.cpp
diff options
context:
space:
mode:
authoryrp <yrp604@protonmail.com>2025-08-19 23:04:48 -0700
committerBrandon Miller <bkmiller89@icloud.com>2025-09-18 07:20:00 -0400
commit8b8d2dd0d39a7c19e6476810ff39a32fc099409e (patch)
treedeba2d509f2609dd31bf57754ab62fef7d88f7e4 /arch/arm64/il.cpp
parentece75114e87b6ad80bc21f1825ac96293272951f (diff)
fix ldrsw lift to sign extend in certain encodings
Diffstat (limited to 'arch/arm64/il.cpp')
-rw-r--r--arch/arm64/il.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm64/il.cpp b/arch/arm64/il.cpp
index 22b45a95..85bc98b2 100644
--- a/arch/arm64/il.cpp
+++ b/arch/arm64/il.cpp
@@ -1082,8 +1082,14 @@ static void LoadStoreOperandSize(LowLevelILFunction& il, bool load, bool sign_ex
il.AddInstruction(ILSETREG_O(operand1, tmp));
break;
case LABEL:
- il.AddInstruction(ILSETREG_O(
- operand1, il.Operand(1, il.Load(size, il.ConstPointer(8, IMM_O(operand2))))));
+ tmp = il.Operand(1, il.Load(size, il.ConstPointer(8, IMM_O(operand2))));
+
+ if (sign_extend)
+ tmp = il.SignExtend(extendSize, tmp);
+ else
+ tmp = il.ZeroExtend(extendSize, tmp);
+
+ il.AddInstruction(ILSETREG_O(operand1, tmp));
break;
default:
il.AddInstruction(il.Unimplemented());