Fix arm offset calculation (#152)

* Fix offset calculation

.subtracted is unreliable, and .disp has the sign anyway

* Use .subtracted for reg offsets
This commit is contained in:
Mark Mossberg 2017-04-20 15:05:08 -04:00 committed by GitHub
parent 4ad028b0df
commit 5ae5daa5c4

View File

@ -133,10 +133,10 @@ class Armv7Operand(Operand):
if self.is_shifted():
shift = self.op.shift
idx, carry = self.cpu._Shift(idx, shift.type, shift.value, carry)
off = idx
off = -idx if self.op.subtracted else idx
else:
off = self.mem.disp
return -off if self.op.subtracted else off
return off
def get_mem_base_addr(self):
assert self.type == 'memory'