I was reading this article " assembly-challenge-jump-to-a-non-relative-address-without-using-registers ".
I need to do exactly what he suggests here (Jump to a non-relative address without using registers), only I need to do it in intel syntax instead of att.
The solution he found for att syntax was:
jmp *0f(%eip)
0: .int 0x12345678
What would this look like in intel syntax?
OK I'll follow the main approach to answer such question by somebody's own.
Created a file with the following contents:
Compiled it and checked report of the same contents (well, your .int is decoded as a command):
(why
gcc
and not directlyas
- well, I was too lazy to recallas
options.)And then, called Intel style decoding:
Let's compare it back:
One can easily see they are identical, and you can follow this method for all similar questions.
NB1: It is crucial to note that Unix binutils interpretation of what is "Intel syntax" will differ in subtle details with what Intel itself thinks (and even in syntax basics, like
0x1234
vs.1234h
), and with wide popular tools like NASM or FASM. Here I assume if you say for AT&T syntax, the most typical Binutils pack (GNU one) is utilized (and my system here is Ubuntu 20.04/x86-64, the nearly most popular one). If Iʼm wrong here, feel free to explore other tools specifics.NB2: The really confusing thing in your code was using relative addressing over EIP. This addressing can be used only in 64-bit mode, but in that case using EIP is weird. An attempt to compile this in 32-bit mode (using e.g.
.code32
) naturally fails.