Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 1999 10:56:13 +0900
From:      KATO Takenori <kato@ganko.eps.nagoya-u.ac.jp>
To:        bde@zeta.org.au
Cc:        FreeBSD98-hackers@jp.freebsd.org
Subject:   Re: cvs commit: src/sys/conf files src/sys/i386/conf files.i386 
Message-ID:  <19990929105613Q.kato@gneiss.eps.nagoya-u.ac.jp>
In-Reply-To: Your message of "Mon, 27 Sep 1999 23:52:49 %2B1000 (EST)" <Pine.BSF.4.10.9909272254200.707-100000@alphplex.bde.org>
References:  <Pine.BSF.4.10.9909272254200.707-100000@alphplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <bde@zeta.org.au> wrote:

> I don't like this much.  At least for PIO, indirection may be best in
> all cases.  I use it for most accesses in sio.  I pre-compute all the
> heavily used port addresses at attach time to avoid additions at
> compile time.
> 
> E.g., the line status port is accessed via com->line_status_port instead
> of via (com->iobase + com_lsr).  The former is always faster (since gcc
> doesn't (can't?) know enough about aliasing to use a previously loaded
> value of com->iobase, and the addition takes some time.  Even if
> com->iobase is explicitly loaded into a (register) variable, the
> computation of (iobase + com_lsr) takes the same time as the load of
> com->line_status_register provided the machine is an i386 and
> com->line_status_register is in the L1 cache.  (This is where MEMIO may
> benefit if we use (iobase + com_lsr).  On machines with base+index
> addressing, the addition tends to be free.  This is also the only excuse
> for pushing the addition to the bus space functions.)

If all drivers use your method, it may not have any problem except you 
pointed.  But if there is a bus_space_foo with non-zero offset, it may 
not work on non-contig address space bus (e.g., ISA-like 16-bit bus on
PC98).  Of cource, such code can be rewrited to solve this problem.

On the point of performance, I think Bruce's method is better
than Warner's method, but on the point of readablity or beauty of
source code, I think Warner's method is better.  Hmm....

-----------------------------------------------+--------------------------+
KATO Takenori <kato@ganko.eps.nagoya-u.ac.jp>  |        FreeBSD           |
Dept. Earth Planet. Sci, Nagoya Univ.          |    The power to serve!   |
Nagoya, 464-8602, Japan                        |  http://www.FreeBSD.org/ |
++++ FreeBSD(98) 3.2:   Rev. 01 available!     |http://www.jp.FreeBSD.org/|
++++ FreeBSD(98) 2.2.8: Rev. 02 available!     +==========================+


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990929105613Q.kato>