From owner-freebsd-hardware Thu Apr 17 19:29:42 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id TAA25623 for hardware-outgoing; Thu, 17 Apr 1997 19:29:42 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA25618 for ; Thu, 17 Apr 1997 19:29:37 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id LAA20954; Fri, 18 Apr 1997 11:58:37 +0930 (CST) From: Michael Smith Message-Id: <199704180228.LAA20954@genesis.atrad.adelaide.edu.au> Subject: Re: talk to I/O Devices. In-Reply-To: <3.0.1.32.19970417092103.0070f97c@lariat.org> from Brett Glass at "Apr 17, 97 09:21:03 am" To: brett@lariat.org (Brett Glass) Date: Fri, 18 Apr 1997 11:58:37 +0930 (CST) Cc: dk+@ua.net, freebsd-hardware@freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hardware@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Brett Glass stands accused of saying: > At 11:54 PM 4/16/97 -0700, Dmitry Kohmanyuk wrote: > > >> Fascinating. What does opening this "file" actually do? (I can't find it > >> in the source.) > > > >look at /sys/i386/i386/mem.c:mmopen() and others in that file. > > Just looked at it, and it appears that this file opens the I/O space > as a random-access device. But accessing ports this way would slow > code down so dramatically that it could be useless for many > control applications! Also, the sample code in previous messages in > this thread seems to indicate that one can read and write directly. > How is this done? It doesn't. The suggestion was to look at mmopen, not the other functions. opening /dev/mem sets the IOPL bit in a process' flags, which allows it to perform I/O instructions without taking a fault. Until very recently, there was no means for any restriction to be placed on this, access was all-or-nothing. Jonathan Lemon and Peter Wemm have been working on some changes which will allow a process to be granted restricted I/O access. > --Brett -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[