Inline Assembly: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Just added a simpler example |
|||
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 |
|||
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== |