Inline Assembly: Difference between revisions

[unchecked revision][unchecked revision]
(Merging some useful examples from http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html in there and cleaning up)
Line 20:
asm ("movl %%eax, %%ebx");
</pre>
...will move eax's content into ebx. Now, you may wonder why this %% comes in. This is where an interesting feature of inline assembly comes in : you can make use of some of your C variables in your assembly code. And since, in order to make implementation of this mechanism simpler, GCC names these variables %0, %1, and so on in your assembly code, starting from the first variable mentioned in the input/output operand sections, you're required to use this %% syntax in order to help GCC making a separation between registers and parameters...
 
How exactly operands work will be explained in more details in later sections. For now, sufficient is to say that if you write something like that...
Anonymous user