Map Device in Memory Block

Maps the physical addresses assigned to a device onto the
linear addresses of a memory block previously allocated with
Int 31H Fn 0504H.

Call With:

AX = 0508H
ESI = memory block handle
EBX = offset within memory block of page(s) to be
mapped (must be page-aligned)
ECX = number of pages to map
EDX = physical address of device (must be
page-aligned)

Returns:

if function successful
Carry flag= clear

if function unsuccessful
Carry flag= set
AX = error code
8001H unsupported function (Device Mapping
Capability not supported)
8003H system integrity (invalid device address)
8023H invalid handle (in ESI)
8025H invalid linear address (specified range
is not within specified block or EBX/EDX
is not page-aligned)

Notes:

o 16-bit DPMI hosts will not support this function. A
16-bit client of a 32-bit DPMI 1.0 host can use this
function.
o Support of this call by 32-bit DPMI hosts is optional.
Application programs or DOS Extenders which require this
call in order to run are not DPMI Compliant.
o Any committed or mapped pages resided in the linear
address range that is being mapped into will be
uncommitted or unmapped automatically by the host.
o All pages created by this call have the mapped bit (bit
2) set in the attributes returned by the Get Page
Attributes function (Int 31H Fn 0506H).
o This functio
n differs from the Create Physical Address Mapping function (Int 31H
Function 0800H) in that this function supports mapping of
physical devices within an existing memory block, rather
than at an arbitrary linear address. Use of an existing
memory block gives 32-bit programs the ability to access
physical devices with NEAR pointers, which is often
highly desirable for performance reasons.
o Unlike Int 31H Fn 0800H, this function allows
mapping of addresses below 1 MB that do not lie within
RAM available for use by programs; e.g. this function can
be used to map the refresh buffers of IBM-compatible
display adapters.
o If the DPMI host is not virtualizing the device, it must
disable any memory caching on the mapped pages; in
particular, on the 486 or later, the PCD (page cache
disable) bit must be set in the page table entries.
o DPMI hosts that do not virtualize physical devices can
support this function by creating page table entries that
map the physical device. The page table entries must be
marked as mapped so that the host knows not to attempt
freeing of physical memory for the pages when the memory
block is freed.
o DPMI hosts are allowed to support this function for some
physical devices and not for others, because mapping of
virtualized devices requires page aliasing in the host -
a complex task. DPMI hosts with partial support for this
function may fail the function call on virtualized
devices (such as displays), and allow the call on
non-virtualized devices (such as the Weitek
coprocessors). Allowing the client to map a physical
device so that it can be accessed with NEAR references,
for example, may help the client achieve considerably
better performance.