Reputation: 31
int context(){"\
movl $0, %eax;\
push $xxxxx;\
push $0;\
push %eax;\
...........
xxxxx : leave;\
ret;");
}
I'm very beginner.
At above source code, I couldn't understand the meaning of "$xxxxx". I thought symbol '$' is only come front of constant.
Moreover, I have never seen last two lines. I know about leave and ret instruction, but "xxxxx :" form is so unfamiliar. I can't find the example looks like it.
Upvotes: 0
Views: 157
Reputation: 340198
The $
prefix signals an immediate operand in the GNU assembler's AT&T syntax. See https://sourceware.org/binutils/docs/as/i386_002dVariations.html#i386_002dVariations:
AT&T immediate operands are preceded by '$';
The line:
xxxxx : leave;
uses xxxxx
as a label (https://sourceware.org/binutils/docs/as/Labels.html#Labels).
A label is written as a symbol immediately followed by a colon `:'
In the case you're wondering about, the value of the label xxxxx
is the immediate operand.
Upvotes: 1