Talk:Inline Assembly: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content deleted Content added
No edit summary
 
No edit summary
Line 6: Line 6:
Page with the contents on it: http://www.osdev.org/osfaq2/index.php/GasIntelHowtoMirror
Page with the contents on it: http://www.osdev.org/osfaq2/index.php/GasIntelHowtoMirror
-- DasCandy
-- DasCandy

Under "Input Operands" I dont think the example code:
<source lang="c">
asm("mov %%eax,%%ebx": : "a" (amount));//useless but it gets the idea
</source>
matches the text, namely I think it should be :
<source lang="c">
int dummy;
asm("add %%eax,%%eax": "=a" (dummy)) : "0" (amount));// the "0" indicate that it's using the same register as the first parameter
</source>
--dormito


[[User:Bewing|Bewing]] 00:20, 28 February 2007 (CST)
[[User:Bewing|Bewing]] 00:20, 28 February 2007 (CST)

Revision as of 10:19, 13 February 2014

The following text came from the OSFAQ on AT&T vs Intel syntax differences -- but it seems to me that it belongs here, instead:

You can switch to intel syntax mode in the inline assembler with a pseudo op, and switch back at the end of the block. -- MirAbile

Page with the contents on it: http://www.osdev.org/osfaq2/index.php/GasIntelHowtoMirror -- DasCandy

Under "Input Operands" I dont think the example code:

asm("mov %%eax,%%ebx": : "a" (amount));//useless but it gets the idea

matches the text, namely I think it should be :

int dummy;
asm("add %%eax,%%eax": "=a" (dummy)) : "0" (amount));// the "0" indicate that it's using the same register as the first parameter

--dormito

Bewing 00:20, 28 February 2007 (CST)