For a class project I am implementing a kernel level network driver which makes use of writing various values to ports. I've created macros for outb
and outw
which all work fine, but outl
continues to give compiler warnings. Defined like this:
#define outl(data, port) \
do { \
asm volatile("outl %l1, (%w0)" \
: \
: "d" (port), "a" (data) \
: "memory", "cc" ); \
} while(0)
The compiler gives the error: invalid 'asm': '%l' operand isn't a label
.
Yet if i define it like this:
#define outl(data, port) \
do { \
asm volatile("outl %1, %0" \
: \
: "dN" (port), "a" (data) \
: "memory", "cc" ); \
} while(0)
I get this message from the assembler: Warning: using '%eax' instead of '%ax' due to 'l' suffix
.
What am I doing wrong? What's the proper syntax to eliminate both of these warnings?