*BSD News Article 89990


Return to BSD News archive

From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: HELP, I need intel assembler and UNIX C porting help - I'm STUCK! ):
Date: 23 Feb 1997 02:02:43 GMT
Organization: Private BSD site, Dresden
Lines: 25
Message-ID: <5eo8g3$9p@uriah.heep.sax.de>
References: <squishE5xo2n.M2y@netcom.com>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.6
X-Phone: +49-351-2012 669
X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F  93 21 E0 7D F9 12 D6 4E
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!ns.saard.net!spasun.tpa.com.au!duster.adelaide.on.net!news.ade.connect.com.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!news.maxwell.syr.edu!news.mathworks.com!fu-berlin.de!irz401!orion.sax.de!uriah.heep!news
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:36020

squish@netcom.com (Michael Almquist) wrote:

> The program compiles FINE but when I run it I get:
> Program received signal SIGBUS (10), Bus error
> 0x178c in __outb (port=100, data=254 '~') at /usr/include/machine/pio.h:149
> 149             __asm __volatile("outb %0,%%dx" : : "a" (data), "d" (port));
> 
> Every single little program I write "outb (0xd6, 0xc1);" "outb(0x60,0xFF);"
> etc crashes with the same error.

Of course.  Normal user programs aren't allowed to perform direct port
IO.  This is an access violation, and the kernel maps it into SIGBUS.

I don't know for NetBSD, but for FreeBSD, the backdoor is to keep a
descriptor on /dev/io open, in order to get IO port privileges.

The correct style however is to write a kernel driver that does the
actualy IO.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)