Skip to content

How do i encode an instruction #367

Answered by mappzor
JenyaRostov asked this question in Q&A
Discussion options

You must be logged in to vote

RIP-rel obviously wouldn't work (>int32), so how should i encode this?

That depends where you want to put your new code. There are two solutions:

  • allocate memory close (within 2GB relative to data you are referencing)
  • use a sequence of instructions, see #360 for example idiom - 1st instructions references rip+2, next one is a jump over 8 bytes of data, 8 bytes of data is an absolute address of data you want to reference. That's some extra work but it will make your code position independent.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@JenyaRostov
Comment options

Comment options

You must be logged in to vote
5 replies
@JenyaRostov
Comment options

@mappzor
Comment options

@JenyaRostov
Comment options

@mappzor
Comment options

@JenyaRostov
Comment options

Answer selected by JenyaRostov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants