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=05H, AL=04H
Allocate Linear Memory Block
AX = 0504H EBX = desired page-aligned linear address of memory block, or zero if linear address unspecified ECX = size of block (bytes, must be nonzero) EDX = flags
|0||0 = create uncommitted pages 1 = create committed pages|
|1-31||reserved, should be zero|
if function successful Carry flag = clear EBX = linear address of memory block ESI = handle for memory block if function unsuccessful Carry flag = set AX = error code 8001H unsupported function (16-bit host) 8012H linear memory unavailable 8013H physical memory unavailable 8014H backing store unavailable 8016H handle unavailable 8021H invalid value (ECX = 0) 8025H invalid linear address (EBX not page aligned)
Allocates a block of page-aligned linear address space. The base address of the block may be specified by the client, and pages within the block may be committed or uncommitted.
A DPMI 1.0 host that is 16-bit only will not support this function.
A 16-bit client of a 32-bit DPMI 1.0 host can use this function.
The allocated block is always page-aligned. If a specific linear address is not requested (EBX = 0), the DPMI host allocates the memory block at any available page-aligned linear address. If a specific linear address is requested (EBX nonzero), the host either allocates the block at the specified address or returns error code 8012H (linear memory unavailable).
Int 31H Function 0501H, which can also be used to allocate linear memory blocks, does not necessarily page-align its blocks and does not have the ability to create uncommitted pages or allocate a block at a specific linear address.
Text based on http://www.delorie.com/djgpp/doc/dpmi/