Mail Archives: djgpp/1997/04/23/04:07:03
On 22 Apr 1997, Gregary J Boyles wrote:
> #define INPORTB(Port,Byte) asm volatile ( \
> "\ninb %1,%%al\n" \
> "movb %%al,%0\n" \
> : "=g"(Byte) \
> : "g"(Port) \
> : "memory","al" \
> )
> Inside the ISR I have two variables : KeyBoardPort and ScanCode.
>
> I want to call the macro as follows : INPORTB(KeyBoardPort,ScanCode).
>
> The problem is that the macro expands to : inb -4(%ebp),%al; movb %al,-9(%ebp);
> and the first argument of inb ends up as a non literal which causes the error
> messages below.
The port must be loaded to the %edx register, that's the only one in and
out can use. Either load Port to %edx and use that with inb, or tell asm
to put Port directly to %edx:
: "d" (Port)
Hope this helps,
Samppa
Samuli Takala Samuli DOT Takala AT hut DOT fi finger -l tax AT hut DOT fi for long version
- Raw text -