*BSD News Article 21210


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!mcsun!sun4nl!tuegate.tue.nl!news.win.tue.nl!wzv.win.tue.nl!gvr.win.tue.nl!guido
From: guido@gvr.win.tue.nl (Guido van Rooij)
Newsgroups: comp.os.386bsd.development
Subject: Re: How do I/O instructions work from user process in 386bsd?
Date: 20 Sep 1993 15:27:44 GMT
Organization: Eindhoven University of Technology, The Netherlands
Lines: 37
Message-ID: <27ki5g$r31@wzv.win.tue.nl>
References: <CDK5vC.Ayn@world.std.com>
NNTP-Posting-Host: gvr.win.tue.nl

hd@world.std.com (HD Associates) writes:

>Quick question:  How does the X server do inb and outb instructions?

>From previous postings I've gathered that the 386 has protection
>rings and normal user processes aren't privileged to do arbitrary port I/O,
>but there is some kind of hardware data structure that you
>can attach to the process that will permit selective access to the
>I/O instructions (i.e., you set it up at context switch time)
>but that we don't have full support for that yet.

>I notice that the X server seems to do inb and outb instructions
>directly.  How is this being accomplished?  Can someone point to
>the code that is setting things up?  I grepped around and didn't
>find it.

There is an extra ioctl in the console driver that gives the process the
privs to do io to whatever port.

In 386bsd, there was a bug however, that manifested itself by allowing io to
random ports. This was fixed by me some time ago, and at the same time I
hacked in code to allow io whenever a user-proces could open /dev/mem (or
when you want, another device with the same major but another minor id).
My fixes are included both in NetBSD and FreeBSD.
>Peter
>-- 
>Peter Dufault               Real Time Machine Control and Simulation
>HD Associates               Voice: 508 433 6936
>hd@world.std.com            Fax:   508 433 5267
>Looking for: Orangey-brown front leather seats or NOS covers for '73 BMW 3.0cs

-Guido
-- 
Guido van Rooij                 |  Internet: guido@gvr.win.tue.nl
Bisschopsmolen 16               |  Phone:    ++31.40.461433
5612 DS Eindhoven               |  ((12+144+20)+3*sqrt(4))/7 
The Netherlands                 |    +(5*11)=9^2+0