Inline assembler operands on x86

Darryl Dixon esrever_otua@hotmail.com
Thu Feb 12 02:59:00 GMT 2004


Hi,

    I'm trying to define a C function that accepts some variables and uses 
them in some x86 assembler.  When I try to compile I get:
/tmp/cc7VC4SL.s: Assembler messages:
/tmp/cc7VC4SL.s:16: Error: suffix or operands invalid for `in'
/tmp/cc7VC4SL.s:16: Error: suffix or operands invalid for `mov'

The code in question is:

--------------8<------------
static int set_hci(int eaxvalue, int ebxvalue, int ecxvalue)
{
  int outval;
  asm ("inb %[baseport],%%al; movb %%ah,%[OUTVAL]" \
            :[OUTVAL]"=r"(outval) \
            :"a"(eaxvalue), "b"(ebxvalue), "c"(ecxvalue), 
[baseport]"r"(BASEPORT));
  return outval;
}
--------------8<------------

This code compiles fine if I drop the OUTVAL and baseport operands and just 
put raw $values in the asm template.  What am I missing here?

|--------from-->Darryl Dixon (RHCE, MCSE, MCSA)
|------handle-->esrever_otua
|--perlhandle-->s&&auto_reverse&&&s&^.+_&$'&ee&&s&$'&&&&print
|----homepage-->http://pythonhacker.is-a-geek.net
|------donate-->https://www.paypal.com/xclick/business=esrever_otua%40hotmail.com&no_note=1&tax=0&currency_code=USD

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail



More information about the Gcc-help mailing list