www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/19/07:18:20

Date: Mon, 19 Apr 1999 15:15:41 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Michal Strelec <strelec AT adam DOT osu DOT cz>
cc: djgpp AT delorie DOT com
Subject: Re: RM or PM interrupts
In-Reply-To: <7feqjh$2is8$1@ns.felk.cvut.cz>
Message-ID: <Pine.SUN.3.91.990419150612.5333B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 19 Apr 1999, Michal Strelec wrote:

> Suppose that my program is in protected mode and suddenly comes interrupt.
> Q1: When interrupt apears and proccesor was in PM it stay in PM?

If it's a hardware interrupt, yes.

> And suppose I've written PM interrupt.

What exactly does this mean?  Does this mean that your program issued a 
software interrupt?

If so, then the way software interrupts are handled depends heavily on 
the DPMI server and on which interrupt did your program issue.  It's 
better to ask more specific questions, if you want a specific answer.

> But my program
> uses reading and writting to ports (function inportsb,...).
> Q2: Are these functions only PM or it has to switch processor to RM?

Reading ports doesn't involve a mode switch, but with some DPMI servers
these functions will cause an exception (not an interrupt) and run slower. 
The exception will be caught by the DPMI server or the underlying OS
(Windows, memory manager), so it is all transparent, except that the
program runs slower. 

> Q3: Suppose these functions are PM. So my program NEVER switch to RM?

If you never call DOS/BIOS and hook all hardware interrupts (like timer 
and keyboard) with your own PM handlers, then your program is always in 
PM.

But if, for example, you leave the timer in its default state, then there
is no PM handler for it, and the CPU will switch to RM and back 18.2 times
a second, to let the BIOS handler of the timer tick interrupt do its job. 
The same happens with the keyboard.  In general, any hardware interrupt
whose normal handler is in the BIOS needs a mode switch, because BIOS uses
real-mode code. 

> Q4: Processor always gets interrupt from timer. And when my program is in PM
> and DPMI catch interrupt from timer, it switch to RM and pass to DOS
> functions, or it has its own PM alternative?

See above.  Windows 9X might have a PM handler, but otherwise you get a 
mode switch.

- Raw text -


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