Skip to content

Commit f553aee

Browse files
committed
ARMv7: Fix lifting of instructions that use register-shifted registers
1 parent aaff6a6 commit f553aee

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

arch/armv7/il.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static ExprId ReadILOperand(LowLevelILFunction& il, InstructionOperand& op, size
287287
case REG:
288288
if (op.shift == SHIFT_NONE)
289289
return ReadRegisterOrPointer(il, op, addr);
290-
else if (op.flags.offsetRegUsed == 1)
290+
else if (op.flags.offsetRegUsed == 1 && op.imm != 0)
291291
{
292292
return GetShiftedOffset(il, op);
293293
}

arch/armv7/test_lift.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
('A', b'\x02\x0a\x83\xed', 'LLIL_STORE.d(LLIL_ADD.d(LLIL_REG.d(r3),LLIL_CONST.d(0x8)),LLIL_REG.d(s0))'),
101101
# vstr d16, [r3, #0x8]
102102
('A', b'\x02\x0b\xc3\xed', 'LLIL_STORE.q(LLIL_ADD.d(LLIL_REG.d(r3),LLIL_CONST.d(0x8)),LLIL_REG.q(d16))'),
103+
# orr r0, r1, r3, lsl r4
104+
('A', b'\x13\x04\x81\xe1', 'LLIL_SET_REG.d(r0,LLIL_OR.d(LLIL_REG.d(r1),LLIL_LSL.d(LLIL_REG.d(r3),LLIL_AND.d(LLIL_REG.d(r4),LLIL_CONST.d(0xFF)))))'),
105+
103106
# mov r2, r0
104107
('T', b'\x02\x46', 'LLIL_SET_REG.d(r2,LLIL_REG.d(r0))'),
105108
# cmp r1, r2

0 commit comments

Comments
 (0)