Skip to content

Commit

Permalink
Support simple syntax for RIP-relative CALL (Maratyszcza#107)
Browse files Browse the repository at this point in the history
Support simple syntax for RIP-relative CALL
  • Loading branch information
tsarpaul authored Jun 28, 2020
1 parent f189ad2 commit 84e60a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions peachpy/x86_64/operand.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ def __init__(self, address, size=None, mask=None, broadcast=None):
from peachpy.x86_64.function import LocalVariable
from peachpy.literal import Constant
assert isinstance(address, (GeneralPurposeRegister64, XMMRegister, YMMRegister, ZMMRegister,
MemoryAddress, Constant, LocalVariable)) or \
MemoryAddress, Constant, LocalVariable, RIPRelativeOffset)) or \
isinstance(address, MaskedRegister) and \
isinstance(address.register, (XMMRegister, YMMRegister, ZMMRegister)) and \
not address.mask.is_zeroing, \
"Only MemoryAddress, 64-bit general-purpose registers, XMM/YMM/ZMM registers, " \
"Only MemoryAddress, 64-bit general-purpose registers, RIP-Relative addresses, XMM/YMM/ZMM registers, " \
"and merge-masked XMM/YMM/ZMM registers may be specified as an address"
from peachpy.util import is_int
assert size is None or is_int(size) and int(size) in SizeSpecification._size_name_map, \
Expand Down Expand Up @@ -279,6 +279,8 @@ def __init__(self, address, size=None, mask=None, broadcast=None):
self.address = MemoryAddress(rsp, displacement=address.offset)
self.symbol = address
self.size = address.size
elif isinstance(address, RIPRelativeOffset):
self.address = address
else:
# Convert register to memory address expression
self.address = MemoryAddress(address)
Expand Down

0 comments on commit 84e60a5

Please sign in to comment.