Article View: alt.msdos.programmer
Article #278Re: Trapping 386 IO port accesses
From: Bernie McIlroy
Date: Wed, 09 Sep 1992 02:14
Date: Wed, 09 Sep 1992 02:14
53 lines
2980 bytes
2980 bytes
In article <_brnq7_.hill@netcom.com> hill@netcom.com (Tom Hill) writes: >In article <tgreen.715550500@pv0547.vincent.iastate.edu> tgreen@iastate. du (Todd Greenfield) writes: >>In <1992Sep03.153802.688@Schultz.ON.CA> peter@Schultz.ON.CA (Peter Roes r) writes: >> >>>In article <tgreen.715391992@vincent2.iastate.edu> tgreen@iastate.edu >>(Todd Greenfield) writes: >>[ original discussion of need to trap access to IO port deleted ] >>>> >>>>what about doing this under windows? I know nothing of windows >>>>programming, but wouldn't it be possible to write a windows >>>>driver (for 386 enh mode of course) to do something like this? >> >>> I have been told that although Windows uses protected mode to do >>> memory management( ie. traps when you talk to non-available mem.) >>> it does not trap IO references. >> >. >. >. >>> Let's keep the discussion going >> >OK, > >You can write what is called a virtual device driver, which will allow >you to trap references to a given port from a DOS session. I'm not sure >if you can trap references from windows apps. Anybody know what IOPL is >for 386 Enhanced mode, and what privilege level windows apps run at? > >Documentation can be found in the windows DDK. (Which I don't have >handy, or I'd look it up myself) and in Daniel Norton's Writing >Device Drivers for Windows. When you write a VxD that traps a specific IO port, any access to that port from _any_ VM (including the system VM (ie: apps under Windows)) will be trapped and execution control will be passed to the VxD. You can, however, from your VxD, disable trapping at any given time to allow a specific VM to "own" that IO port. This can be either DOS box VMs or the system VM. Just FYI: for Windows 3.0, applications ran at ring 3 and "special" drivers ran in ring 1. For Windows 3.1, both applications and drivers for Windows run at ring 3. In both 3.0 and 3.1 the VMM (virtual machine manager) which includes low-level memory management, interrupt handling, IO port trapping, and any VxDs that are loaded, all run in ring 0. -------------------------------------------------------------------- The above opinions are mine and you can't have them; so there.
Technical Details
Message-ID:
<1992Sep9.021405.5767@mnemosyne.cs.du.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!mnemosyne.cs.du.edu!nyx!bmcilroyReferences:
<1992Sep03.153802.688@Schultz.ON.CA> <tgreen.715550500@pv0547Show Full Headers
Complete Article Headers
Newsgroups: alt.msdos.programmer,comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!mnemosyne.cs.du.edu!nyx!bmcilroy From: bmcilroy@nyx.cs.du.edu (Bernie McIlroy) Subject: Re: Trapping 386 IO port accesses Message-ID: <1992Sep9.021405.5767@mnemosyne.cs.du.edu> X-Disclaimer: Nyx is a public access Unix system run by the University of Denver for the Denver community. The University has neither control over nor responsibility for the opinions of users. Sender: usenet@mnemosyne.cs.du.edu (netnews admin account) Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept. References: <1992Sep03.153802.688@Schultz.ON.CA> <tgreen.715550500@pv0547 Distribution: na Date: Wed, 9 Sep 92 02:14:05 GMT Lines: 62