{{page>en:templates:dpmi}} ====== Int 31H, AH=05H, AL=08H ====== ===== Version ===== 1.0 ===== Brief ===== Map Device in Memory Block ===== Input ===== 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) ===== Return ===== if function successful Carry flag = clear if function unsuccessful Carry flag = set AX = error code Capability not supported) 8001H unsupported function (Device Mapping 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 ===== Maps the physical addresses assigned to a device onto the linear addresses of a memory block previously allocated with Int 31H Function 0504H. 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. 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. 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. 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 Function 0506H). This function 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. Unlike Int 31H Function 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. 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. 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. 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. ===== See also ===== ===== Note ===== Text based on [[http://www.delorie.com/djgpp/doc/dpmi/]] {{page>en:templates:dpmi:int}}