steve@MorningStar.COM (Steve Wilson) (01/13/90)
I'm trying to use gcc 1.36 to produce '386 code. Most of the
peripherals I need to access are not memory-mapped, so I need to use
the "in" (inb, inw, inl) and "out" (outb, outw, outl) instructions.
The first question: Am I missing some simple, obvious way to do this
from `C' routines?
The second question: Assuming the asnwer to the first questions is
no, I've tried defining macros such as:
# define outb(port, value) __asm__("outb %1,%0" \
: /* no outputs */ \
: "d" (port), "a" (value))
This almost produces what is needed, except that the outb instruction
ends up as "outb %eax,%edx" which the gnu assembler doesn't like
(should use the byte registers %al and %dl in place of %eax and %edx).
There don't seem to be any constraints similar to "d" and "a" as used
in the macro to force the use of %al and %dl instead of %eax and %edx.
Again, am I missing the obvious?
Further problem is if I try:
# define outb(port, value) __asm__("outb %al,%dl" \
: /* no outputs */ \
: "d" (port), "a" (value))
to force the use of %al and %dl (the constraints "d" and "a" already
see to it the data is in an acceptable place), then gcc complains
"invalid `asm': operand number missing after %-letter". Evidently, it
doesn't accept the specific register designation involving the "%",
but gas does require this.
Suggestions? Pointers? I'm no gnu expert at all, but given some
pointers I might be able to explore further.
--
Steve Wilson, Morning Star Technologies steve@MorningStar.COM