Junks ax after expression

56 Views Asked by At

This code works as a IN func for i/o ports in inline c:

int func(short port)
{
    short data;
    __asm__(
        ".intel_syntax \n\t"
        "in byte %0, %1\n\t"

        ".att_syntax\n\t"
        :"=a" (data)
        :"dN" (port)
        :
    );
    return data;
}

but on compiling the c code the assembler outputs:

file.c:5: Error: junk `ax' after expression

Here is the compiling command

gcc -ffreestanding -m32 -c file.c -o file.o

I tried viewing the code in assemly using -S flag but it seems to be fine

0

There are 0 best solutions below