Page 1 of 1

64 bit mode, inline assembler, "outl %0,%w1" compi

Posted: Tue Feb 19, 2008 1:10 am
by rjying
wrote the inline assembler in the C code:
void outl(unsigned short port,unsigned long vaule)
{
__asm__ __volatile__ ( "outl %0,%w1" ::"a"(vaule),"d"(port));
}
But issue error when it's compiled.
that prompted, %0 refers "rax".
But the outl instruction only refers 32bit register.
I can modify "outl %0,%w1" to "outl %%eax,%w1".

But I hope use other way to fix it, just like %0 to use the input parameters.
Thanks

Posted: Tue Feb 19, 2008 4:54 am
by Combuster
OUTs (and INs) only works with al/ax/eax and dx/constant as its operands. Having GCC choose the registers will only give you trouble since instead of the few options that are actually legal, it may choose practically everything.

Posted: Thu Feb 21, 2008 8:26 pm
by rjying
Thanks
Do you mean that I must use the "%%eax" to fix it?