Return to BSD News archive
Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.uwa.edu.au!disco.iinet.net.au!wa.news.telstra.net!act.news.telstra.net!psgrain!usenet.eel.ufl.edu!news-peer.gsl.net!news.gsl.net!swrinde.nde.swri.edu!newsfeed.internetmci.com!in3.uu.net!EU.net!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!uknet!newsfeed.ed.ac.uk!edcogsci!richard
From: richard@cogsci.ed.ac.uk (Richard Tobin)
Subject: Re: gcc optimizations for kernel
X-Nntp-Posting-Host: pitcairn
Message-ID: <DxvLuK.JrK@cogsci.ed.ac.uk>
Sender: cnews@cogsci.ed.ac.uk (C News Software)
Organization: HCRC, University of Edinburgh
References: <51d0eg$9uf@usenet4.interramp.com> <323A693E.7B4C@OntheNet.com.au>
Date: Tue, 17 Sep 1996 12:11:07 GMT
Lines: 21
In article <323A693E.7B4C@OntheNet.com.au> tonyg@OntheNet.com.au writes:
>The higher levels of optimisation are "probably" OK for non-device
>driver code, but would almost certainly bring you undone in a driver.
>Re-arranging the order of 'bashing' device registers is generally not a
>good thing.
The use of "volatile" in the (inline) functions that do i/o should
ensure that the instructions don't get reordered (much). For example:
static __inline u_short
inw(u_int port)
{
u_short data;
__asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port));
return (data);
}
-- Richard
--
:wq