Note: This API calls are shared between DOS and Win16 personality.
DPMI is a shared interface for DOS applications to access Intel 80286+ CPUs services. DOS DMPI host provides core services for protected mode applications. Multitasking OS with DOS support also provides DMPI in most cases. Windows standard and extended mode kernel is a DPMI client app. Standard and extended mode kernel differs minimally and shares common codebase. Standard Windows kernel works under DOSX extender. DOSX is a specialized version of 16-bit DPMI Extender (but it is standard DPMI host). Standard mode is just DPMI client, exnhanced mode is DPMI client running under Virtual Machime Manager (really, multitasker which allow to run many DOS sessions). Both modes shares DPMI interface for kernel communication. The OS/2 virtual DOS Protected Mode Interface (VDPMI) device driver provides Version 0.9 DPMI support for virtual DOS machines. Win16 (up to Windows ME) provides Version 0.9 DPMI support.
DPMI host often merged with DPMI extender. Usually DPMI extender provide DPMI host standard services and DOS translation or True DPMI services.
Int 31H, AH=03H, AL=01H
Call Real Mode Procedure With Far Return Frame
AX = 0301H BH = flags
|0||reserved for historical reason, must be zero|
|1-7||reserved, must be zero|
CX = number of words to copy from protected mode to real mode stack ES:(E)DI = selector:offset of real mode register data structure in the following format:
|00H||4||DI or EDI|
|04H||4||SI or ESI|
|08H||4||BP or EBP|
|10H||4||BX or EBX|
|14H||4||DX or EDX|
|18H||4||CX or ECX|
|1CH||4||AX or EAX|
|20H||2||CPU status flags|
if function successful Carry flag = clear ES:(E)DI = selector:offset of modified real mode register data structure if function unsuccessful Carry flag = set AX = error code 8012H linear memory unavailable (stack) 8013H physical memory unavailable (stack) 8014H backing store unavailable (stack) 8021H invalid value (CX too large)
Simulates a FAR CALL to a real mode procedure. The called procedure must return by executing a RETF (far return) instruction.
32-bit programs must use ES:EDI to point to the real mode register data structure. 16-bit programs should use ES:DI.
The CS:IP in the real mode register data structure specifies the address of the real mode procedure to call.
If the SS:SP fields in the real mode register data structure are zero, a real mode stack will be provided by the DPMI host. Otherwise, the real mode SS:SP will be set to the specified values before the interrupt handler is called.
Values placed in the segment register positions of the data structure must be valid for real mode; i.e. the values must be paragraph addresses and not selectors.
All general register fields in the data structure are DWORDs so that 32-bit registers can be passed to real mode. Note, however, that 16-bit hosts are not required to pass the high word of 32-bit general registers or the FS and GS segment registers to real mode even when running on an 80386 or later CPU.
The target real mode procedure must return with the stack in the same state as when it was called. This means that the real mode code may switch stacks while it is running, but must return on the same stack that it was called on and must exit with a RETF (far return) and should not clear the stack of any other parameters that were passed to it on the stack.
When this function returns, the real mode register data structure will contain the values that were returned by the real mode procedure.
It is the caller's responsibility to remove any parameters that were pushed on the protected mode stack.
Text based on http://www.delorie.com/djgpp/doc/dpmi/