Article View: gnu.gcc.help
Article #50727Re: GCC asm in-line on 386 code?
From: David Kastrup
Date: Mon, 16 Aug 1993 13:23
Date: Mon, 16 Aug 1993 13:23
23 lines
1797 bytes
1797 bytes
strauch@emmy.mathematik.uni-dortmund.de (Michael Strauch) writes:
>jzh@abb-sc.abb-sc.com (Jason Huang) writes:
>>Anybody like to point me out on assembler instruction
>>using 'asm' please? For I/O instructions, IN AL,DX; OUT DX,AL.
>Try this one: asm("inb %dx,%al");
> asm("outb %al,%dx");
Better not try it. It might produce the wanted code (not TOO sure about
it, though), but will not inform the compiler about what registers
it clobbers. Try something like
asm volatile("inb %1,%0" : "a" (char-variable) : "d" (word-expression))
the volatile tells gnu not to significantly move this template,
the d and a tell it only that registers satisfy the register constraints
(will more registers/addressing modes work with i386?)
resp. First group are output parameters, second input.
asm volatile("outb %0,%1" : : "a" (char-exp), "d" (word-exp))
--
David Kastrup dak@pool.informatik.rwth-aachen.de
Tel: +49-241-72419 Fax: +49-241-79502
Goethestr. 20, D-52064 Aachen
Technical Details
Message-ID:
<24o1nn$qjd@urmel.informatik.rwth-aachen.de>Path:
arc1-ca.pugleaf.net!gmd.de!urmel.informatik.rwth-aachen.de!messua!dakReferences:
<1760@abb-sc.abb-sc.COM> <24nn9pINNh0l@unidoct.Chemietechnik.Uni-Dortmund.DE>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,636eb8e2b1c1a855 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-08-16 06:23:02 PST Path: arc1-ca.pugleaf.net!gmd.de!urmel.informatik.rwth-aachen.de!messua!dak From: dak@messua.informatik.rwth-aachen.de (David Kastrup) Newsgroups: gnu.gcc.help Subject: Re: GCC asm in-line on 386 code? Date: 16 Aug 1993 13:23:03 GMT Organization: Rechnerbetrieb Informatik - RWTH Aachen Lines: 23 Distribution: world Message-ID: <24o1nn$qjd@urmel.informatik.rwth-aachen.de> References: <1760@abb-sc.abb-sc.COM> <24nn9pINNh0l@unidoct.Chemietechnik.Uni-Dortmund.DE> NNTP-Posting-Host: messua.informatik.rwth-aachen.de Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit