Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RIP call #106

Open
tsarpaul opened this issue Jun 28, 2020 · 2 comments
Open

RIP call #106

tsarpaul opened this issue Jun 28, 2020 · 2 comments

Comments

@tsarpaul
Copy link
Contributor

tsarpaul commented Jun 28, 2020

Hi, I'm trying to assemble a position independent piece of code.
I'm trying to create a CALL with a relative pointer using PC/IP:

from peachpy.x86_64 import *
from peachpy.x86_64.registers import rip

call = CALL([rip+8])

and I'm getting:

~/.local/lib/python3.6/site-packages/peachpy/x86_64/generic.py in __init__(self, *args, **kwargs)
   9875             origin = inspect.stack()
   9876         super(CALL, self).__init__("CALL", origin=origin, prototype=prototype)
-> 9877         self.operands = tuple(map(check_operand, args))
   9878         if len(self.operands) != 1:
   9879             raise SyntaxError("Instruction \"CALL\" requires 1 operands")

~/.local/lib/python3.6/site-packages/peachpy/x86_64/operand.py in check_operand(operand)
     26         if len(operand) != 1:
     27             raise ValueError("Memory operands must be represented by a list with only one element")
---> 28         return MemoryOperand(operand[0])
     29     elif isinstance(operand, Constant):
     30         from copy import copy, deepcopy

~/.local/lib/python3.6/site-packages/peachpy/x86_64/operand.py in __init__(self, address, size, mask, broadcast)
    249             isinstance(address.register, (XMMRegister, YMMRegister, ZMMRegister)) and \
    250             not address.mask.is_zeroing, \
--> 251             "Only MemoryAddress, 64-bit general-purpose registers, XMM/YMM/ZMM registers, " \
    252             "and merge-masked XMM/YMM/ZMM registers may be specified as an address"
    253         from peachpy.util import is_int

AssertionError: Only MemoryAddress, 64-bit general-purpose registers, XMM/YMM/ZMM registers, and merge-masked XMM/YMM/ZMM registers may be specified as an address

Am I doing something wrong?

@tsarpaul
Copy link
Contributor Author

tsarpaul commented Jun 28, 2020

From reviewing some pull requests I'm supposed to do:

CALL(RIPRelativeOffset(8))

@tsarpaul
Copy link
Contributor Author

Added a pull request to simplify this syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant