Article View: gnu.gcc.bug
Article #2831i386 "in" & "out", or asm() problem.
From: Steve Wilson
Date: Fri, 12 Jan 1990 19:32
Date: Fri, 12 Jan 1990 19:32
37 lines
1953 bytes
1953 bytes
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
Technical Details
Message-ID:
<1990Jan12.193241.956@MorningStar.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!mstar!steveShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!mstar!steve From: steve@MorningStar.COM (Steve Wilson) Newsgroups: gnu.gcc.bug Subject: i386 "in" & "out", or asm() problem. Message-ID: <1990Jan12.193241.956@MorningStar.COM> Date: 12 Jan 90 19:32:41 GMT Distribution: na Organization: Morning Star Technologies, Columbus, Ohio Lines: 37