Inline Assembly: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Reverted edits by Nekros (Talk); changed back to last version by Walling
Undo revision 7409 by Nekros (Talk)
Line 44: Line 44:


These labels are in a namespace of their own, and will not collide with any C identifiers. The same can be done for input operands, too.
These labels are in a namespace of their own, and will not collide with any C identifiers. The same can be done for input operands, too.
Input Operands
==Input Operands==


The Input Operands allow to parameterize the ASM code; i.e., passing parameters from C code to ASM block. Again, string literals are used to specify the details.
The Input Operands allow to parameterize the ASM code; i.e., passing parameters from C code to ASM block. Again, string literals are used to specify the details.
Line 63: Line 63:


The correct thing to do when input operands are written to is to list them as dummy outputs (instead of trying to list them as clobbers).
The correct thing to do when input operands are written to is to list them as dummy outputs (instead of trying to list them as clobbers).

Here is a simple example:
<pre>
asm("mov %%eax,%%ebx": : "a" (amount));//useless but it gets the idea
</pre>

Eax will contain "amount" and be moved into ebx.


==Clobbered Registers List==
==Clobbered Registers List==