www.delorie.com/djgpp/doc/dpmi/ch4.4.html   search  
Handling Interrupts

When a DPMI client switches into protected mode, a unique interrupt descriptor table (IDT) is created for the client by the DPMI host. Initially, all software interrupts (except for Int 31H, Int 2FH and Int 21H Function 4CH) or external hardware interrupts are directed to a handler that simply reflects the interrupt to real mode; i.e. the DPMI host's default handler simply switches the CPU into real mode and re-issues the interrupt, so that it can be serviced by the original real mod owner of the interrupt. The contents of the general registers and flags are passed to the real mode handler and the modified registers and flags are returned to the protected mode handler. Segment registers and the stack pointer are not passed between modes; the contents of the segment registers after the switch to real mode are undefined, and the DPMI host automatically supplies a valid real mode stack.

DPMI clients can install their own distinct real mode or protected mode handlers for software and external hardware interrupts with Functions 0201H and 0205H respectively. If a protected mode handler is installed, it is called instead of any real mode handler or the DPMI host's default handler. Just as in real mode, the protected mode handler can either service the interrupt and terminate with an IRET, or transfer to the next handler in the chain by executing a PUSHF/CALL or a FAR JMP. The final handler in the protected mode handler chain (the DPMI host's default handler) will reflect the interrupt to real mode.


Virtual Interrupts
Hardware Interrupts
Software Interrupts

  prev   next     webmaster   donations   bookstore     delorie software   privacy  
  Copyright 1999   by DJ Delorie     Updated Feb 1999