Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Oct 1997 08:44:33 +0200
From:      Michael Schuster <Michael.Schuster@utimaco.co.at>
To:        "hackers@FreeBSD.ORG" <hackers@FreeBSD.ORG>
Subject:   Re: outb() / inb()
Message-ID:  <344AFDD1.52D4AF96@utimaco.co.at>

next in thread | raw e-mail | index | archive | help
0000-Administrator <root@trojanhorse.ml.org> wrote:
> outb (0x250, *c++);  /* doesn't work whereas */
> outb (0x250, *c); c++; /* works */
> 
> I would guess (but cannot verify) that 
> 
> 
> *c++ = inb (0x250);  /* probably works since the increment expression is 
>                       * not part of the macro */
> 
> can somebody verify this for me I am pretty sure about the inb (even
> though I can't test it easily), as for the outb since outb just is a macro
> that puts in an inline function outbv() why does it not work?

right: (copied by hand from /usr/include/machine/coufuncs.h):

>#define outb(port,data) \
>	 <....>          \
>       ? outbc(port,data):outbv(port,data))

which means that if you write 
	outb (0x250, *c++);
then the expression "*c++" gets evaluated twice, and only every other
byte is output to port 0x250.
Your solution is correct.

Michael
-- 
Michael Schuster
Utimaco Safe Concept GmbH. | Tel: +43 732 655755 41
Europaplatz 6              | Fax: +43 732 655755 5
A-4020 Linz Austria        | email: Michael.Schuster@utimaco.co.at



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?344AFDD1.52D4AF96>