x86_64: absolute JMP to 32-bit address fit in 8 bytes

0

I use Windows 7; architecture is x86_64. I need to do absolute jump from one address to another (distance between these adresses is more than 0xFFFFFFFF, so I could not use relative jump). I have used this code:

mov rax, 0000000011223344
jmp rax

It works well; but it's length is 12 bytes (which is too much - 8 bytes is maximal length). I mentioned that my address can always fit into 4 bytes, so I corrected the code:

mov eax, 11223344
jmp rax

It's length is 7 bytes, and it works well until some data comes in rax in high-order DWORD. For example, if rax contains 000007FE 00000000, it jumps on 000007FE 11223344, not to the 00000000 11223344. So, the application crashes, because there is no data at 000007FE 11223344.

How can I write absolute jump code in x86_64, using 32-bit address, with total instruction's length <= 8 bytes?

assembly
x86-64
asked on Stack Overflow Mar 23, 2015 by cls • edited Apr 15, 2019 by 1201ProgramAlarm

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0