Page 1 of 1
GAS Syntax
Posted: Thu Jan 10, 2008 6:26 am
by crazygray1
Is there anything that changes in gcc inline asm when you use Intel syntax.
Posted: Thu Jan 10, 2008 6:41 am
by os64dev
Google is your best friend here and otherwise search this forum as the subject has only been addressed a few million times before.
gcc -v --help reveals a -masm option
google gcc masm reveals
gcc -masm=intel
took about a minute
Posted: Thu Jan 10, 2008 6:55 am
by Solar
Unfortunately, unless I misread the GCC info page, -masm=intel affects the output of GCC, i.e. what you get when you do gcc -S...
Posted: Thu Jan 10, 2008 5:04 pm
by crazygray1
I decided against intel syntax, here is my outb function
Code: Select all
void outb(uchar_t in, uint16_t outp)
{
asm("outb %%al,%%dx"
: /*none to pass*/
:"a" (in),"d" (outp));
};
are there any errors?
Posted: Thu Jan 10, 2008 9:24 pm
by ucosty
Looks fine, except for the semicolon at the end.
Re: GAS Syntax
Posted: Fri Jan 11, 2008 6:15 am
by jal
crazygray1 wrote:Is there anything that changes in gcc inline asm when you use Intel syntax.
See
here or
here. Basically, use ".intel_syntax noprefix" in your assembly. Cannot find whether there's an easier way.
JAL
Posted: Fri Jan 11, 2008 6:33 am
by crazygray1
ucosty wrote:Looks fine, except for the semicolon at the end.
What's wrong with the semicolon? It doesn't need to be there but it doesn't cause any problems.
Posted: Fri Jan 11, 2008 6:56 am
by ucosty
It's just weird that you would put one there where none is needed. Thats all.
Posted: Fri Jan 11, 2008 7:20 am
by JamesM
The semicolon at the end of that function is Just Wrong (tm).
Posted: Fri Jan 11, 2008 9:51 am
by os64dev
crazygray1 wrote:ucosty wrote:Looks fine, except for the semicolon at the end.
What's wrong with the semicolon? It doesn't need to be there but it doesn't cause any problems.
I think they blew up an satellite once because of a semicolon (or other character) so i would be hesitant with you remark.
@solar
Oops, my bad. I should verify before i post