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?
User contributions licensed under CC BY-SA 3.0