delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/06/08:40:08

From: "Charles Sandmann" <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DPMI and I/O question
Date: Thu, 5 Jun 1997 14:51:17
Organization: Aspen Technology, Inc.
Lines: 37
Message-ID: <3396d265.sandmann@clio.rice.edu>
References: <3395C778 DOT 2470 AT emu DOT com>
Reply-To: sandmann AT clio DOT rice DOT edu
NNTP-Posting-Host: spica.dmccorp.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> I want to trap writes to certain or all I/O ports.  

In V86 16-bit mode, or in 32-bit protected mode?

> I want to write a DPMI compliant driver that can run in DOS, without
> Windows being loaded, that allows this.

If you just want this behavior in 32-bit protected mode, you can easily
hack this into CWSDPMI by modifying the TSS length, values, and IOPL.

> #1.  Do QEMM, 386MAX, and other DPMI servers, by default, place the chip
> in V86 while running DOS?  

If you have an EMM present, you will almost always run in V86 mode.  Since
QEMM and 386MAX are EMM providers, you end up in V86 mode, yes.  But I don't
think you have access to the V86 control structures to allow you to
mess with the IO permissions or capture the exceptions.

> I noticed in the DPMI 0.9 spec that this is
> only an OPTION for DPMI servers, but they can also run in real mode.  

CWSDPMI actually does BOTH.  If you are running under HIMEM (or bare) 
CWSDPMI will leave the machine in real mode when running DOS (since I 
didn't want to bother writing a V86 monitor).  If you are running under
an EMM, CWSDPMI uses the V86 provided.

> #2.  How do I set the I/O map for the V86 session in a way that DPMI
> allows?

You can't.  This is a very low level function (below DPMI).

> Basically, I want to virtualize some hardware unbeknownst to DOS programs.

Check comp.lang.asm.x86 (if you can tolerate the flamewars) - I have seen
some custom V86 monitor urls posted there which allow you to watch ports.  
People use them to reverse engineer what's happening on dongle writes to
LPT ports, etc.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019