Mail Archives: djgpp/1999/04/19/07:18:20
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 -