Inline Assembly: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Line 102: | Line 102: | ||
| x can be whatever the compiler prefers: a register, a memory reference. It could even be a literal constant in another context. |
| x can be whatever the compiler prefers: a register, a memory reference. It could even be a literal constant in another context. |
||
|- |
|- |
||
| <code>"movl % |
| <code>"movl %%es, %0" : "='''r'''" (x)</code> |
||
| you want x to go through a register (this is an x86-specific constraint). If x wasn't optimized as a register, the compiler will then move it to the place it should be. This means that <code>"movl %0, %%es" : : "r" (0x38)</code> is enough to load a segment register. |
| you want x to go through a register (this is an x86-specific constraint). If x wasn't optimized as a register, the compiler will then move it to the place it should be. This means that <code>"movl %0, %%es" : : "r" (0x38)</code> is enough to load a segment register. |
||
|- |
|- |