add directory study

This commit is contained in:
gohigh
2024-02-19 00:25:23 -05:00
parent b1306b38b1
commit f3774e2f8c
4001 changed files with 2285787 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<h2>Obtain Real-to-Protected Mode Switch Entry Point
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
This function can be called in real mode only to test for
the presence of a DPMI host, and to obtain an address of a
mode switch routine that can be called to begin execution in
protected mode. <p>
<b>Call With</b><br>
<img src="r/ax.gif" alt="" width=245 height=59><br>
AX = 1687h <br clear>
<b>Returns</b><br>
<img src="r/ax+bx+cl+dh+dl+si+E+di.gif" alt="" width=245 height=59><br>
<i>If function successful</i><br>
AX = 0<br>
BX = flags
<blockquote><table border=1 cellspacing=0 cellpadding=4>
<tr><th>Bit</th><th>Significance</th></tr>
<tr><td rowspan=2 align=center>0</td><td align=left>0 = 32-bit programs are not supported</td></tr>
<tr><td align=left>1 = 32-bit programs are supported</td></tr>
<tr><td align=center>1-15</td><td align=left>not used</td></tr>
</table></blockquote>
CL = processor type
<blockquote><table border=1 cellspacing=0 cellpadding=4>
<tr><th>Value</th><th>Significance</th></tr>
<tr><td align=center>02H</td><td align=left>80286</td></tr>
<tr><td align=center>03H</td><td align=left>80386</td></tr>
<tr><td align=center>04H</td><td align=left>80486</td></tr>
<tr><td align=center>05H-FFH</td><td align=left>Reserved for future Intel processors</td></tr>
</table></blockquote>
DH = DPMI major version as a decimal number
(represented in binary)<br>
DL = DPMI minor version as a decimal number
(represented in binary)<br>
SI = number of paragraphs required for DPMI host
private data (may be 0)<br>
ES:DI = segment:offset of procedure to call to enter
protected mode<p>
<i>if function unsuccessful (no DPMI host present)</i><br>
AX = nonzero<p>
<h2>Notes</h2>
<ul>
<li>The entry point returned by <a href="2f1687.html">Int 2FH Function
1687H</a> is only called for the first switch to protected mode by a
DPMI client. For further details on the protocol for switching to
protected mode and the environment after switching to protected mode,
see <a href="../ch4.1.html">that page</a>.<p>
<li>Under DPMI hosts, the major version number is returned in DH and
the minor version number is returned in DL. There are two decimal
digits for the minor version number with the least-significant digit
representing the revision number of the minor version number. Under
DPMI version 0.9 hosts, DH is returned as 0, and DL is returned as
decimal 90 (5AH). In hypothetical DPMI version 2.3, DH would be
returned as 2 and DL would be returned as 30 (1EH).<p>
</ul>

View File

@@ -0,0 +1,81 @@
<h2>Allocate DOS Memory Block
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Allocates a block of memory from the DOS memory pool, i.e.
memory below the 1 MB boundary that is controlled by DOS.
Such memory blocks are typically used to exchange data with
real mode programs, TSRs, or device drivers. The function
returns both the real mode segment base address of the block
and one or more descriptors that can be used by protected
mode applications to access the block.<p>
<b>Call With</b><br>
<img src="r/ax+bx.gif" alt="" width=245 height=59><br>
AX = 0100H<br>
BX = number of (16-byte) paragraphs desired<p>
<b>Returns</b><br>
<img src="r/ax+bx+dx+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<br>
AX = real mode segment base address of allocated
block<br>
DX = selector for allocated block<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>0007H</td><td>memory control blocks damaged (also returned by
DPMI 0.9 hosts)</td></tr>
<tr><td>0008H</td><td>insufficient memory (also returned by DPMI 0.9
hosts).</td></tr>
<tr><td>8011H</td><td>descriptor unavailable</td></tr>
</table>
BX = size of largest available block in paragraphs<p>
<h2>Notes</h2>
<ul>
<li>If the size of the block requested is greater than 64 KB (BX >
1000H) and the client is a 16-bit program, contiguous descriptors are
allocated and the base selector is returned. The consecutive
selectors for the memory block can be calculated using the value
returned by the Get Selector Increment Value function (<a
href="310003.html">Int 31H Function 0003H</a>). Each descriptor has a
limit of 64 KB, except for the last which has a limit of blocksize MOD
64 KB.<p>
<li>If the DPMI host is 32-bit, the client is 16-bit, and more than
one descriptor is allocated, the limit of the first descriptor will be
set to the size of the entire block. Subsequent descriptors have
limits as described in the previous Note. 16-bit DPMI hosts will
always set the limit of the first descriptor to 64 KB even when
running on an 80386 (or later) machine.<p>
<li>When the client is 32-bit, this function always allocates only one
descriptor.<p>
<li>Client programs should never modify or free any descriptors
allocated by this function. The Free DOS Memory Block function (<a
href="310101.html">Int 31H Function 0101H</a>) will deallocate the
descriptors automatically.<p>
<li>The DOS allocation function (Int 21H Function 48H) is used.<p>
<li>Refer to the rules for descriptor usage in <a href="../descriptor-rules.html">Appendix D</a>.<p>
</ul>

View File

@@ -0,0 +1,34 @@
<h2>Set Real Mode Interrupt Vector
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Sets the current virtual machine's real mode interrupt
vector for the specified interrupt.<p>
<b>Call With</b><br>
<img src="r/ax+bl+cx+dx.gif" alt="" width=245 height=59><br>
AX = 0201H<br>
BL = interrupt number<br>
CX:DX = segment:offset of real mode interrupt handler<p>
<b>Returns</b><br>
<img src="r/c.gif" alt="" width=245 height=59><br>
Carry flag = clear (this function always succeeds)<p>
<h2>Notes</h2><ul>
<li>The address passed in CX must be a real mode segment address, not
a selector. Consequently, the interrupt handler must either reside in
DOS memory (i.e. below the 1 MB boundary) or the client must allocate
a real mode callback address. See <a href="310100.html">Int 31H
Functions 0100H</a> and <a href="310303.html">0303H</a>.<p>
<li>If the interrupt being hooked is a hardware interrupt, the memory
that the interrupt handler uses must be locked.<p>
</ul>

View File

@@ -0,0 +1,64 @@
<h2>Set Processor Exception Handler Vector
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Sets the address of a handler for a CPU exception or fault, allowing a
protected mode application to intercept processor exceptions (such as
segment not present faults) that are not handled by the DPMI host and
would otherwise generate a fatal error. This function should be
avoided by DPMI 1.0 clients (see Notes).<p>
<b>Call With</b><br>
<img src="r/ax+bl+cx+edx.gif" alt="" width=245 height=59><br>
AX = 0203H<br>
BL = exception/fault number (00H-1FH)<br>
CX:(E)DX = selector:offset of exception handler<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8021H</td><td>invalid value (BL not in range 0-1FH)</td></tr>
<tr><td>8022H</td><td>invalid selector</td></tr>
</table>
<h2>Notes</h2><ul>
<li>The value passed in CX should be a valid protected mode code
(executable) selector, not a real mode segment address.<p>
<li>32-bit clients must supply a 32-bit offset in the EDX register.
If the client's handler chains to the next exception handler, it must
do so using a 32-bit interrupt stack frame.<p>
<li>Every exception is first examined by the DPMI host. If the host
does not handle the exception, it reflects the exception to the first
handler in the protected mode exception handler chain. See <a
href="../ch4.5.html">that page</a> for a complete discussion of the
environment and responsibilities of protected mode exception handlers
installed with this function.<p>
<li>Clients which run under DPMI 1.0 should use <a
href="310212.html">Int 31H Functions 0212H</a> and <a
href="310213.html">0213H</a> to set the addresses of exception
handlers. This function is supported by DPMI 1.0 hosts solely for
compatibility with DPMI 0.9.<p>
<li>Refer to the rules for descriptor usage in <a href="../descriptor-rules.html">Appendix D</a>.
</ul>

View File

@@ -0,0 +1,47 @@
<h2>Set Extended Processor Exception Handler Vector (Protected Mode)
<img src="../1.0.gif" alt="[1.0]" width=22 height=17></h2>
Sets the address of the client's protected mode handler for
the specified protected mode exception.<p>
<b>Call With</b><br>
<img src="r/ax+bl+cx+edx.gif" alt="" width=245 height=59><br>
AX = 0212H<br>
BL = exception/fault number (00H-1FH)<br>
CX:(E)DX = selector:offset of exception handler<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8021H</td><td>invalid value (BL not in range 00H-1FH)</td></tr>
<tr><td>8022H</td><td>invalid selector</td></tr>
</table>
<h2>Notes</h2>
<ul>
<li>DPMI 1.0 clients should use this function in preference to <a
href="310203.html">Int 31H Function 0203H</a>.<p>
<li>The protected mode exceptions are sent to the protected mode
handler of the current client.<p>
<li>Refer to the rules for descriptor usage in <a href="../descriptor-rules.html">Appendix D</a>.<p>
</ul>

View File

@@ -0,0 +1,50 @@
<h2>Set Extended Processor Exception Handler Vector (Real Mode)
<img src="../1.0.gif" alt="[1.0]" width=22 height=17></h2>
Sets the address of the client's protected mode handler for the
specified real mode exception.<p>
<b>Call With</b><br>
<img src="r/ax+bl+cx+edx.gif" alt="" width=245 height=59><br>
AX = 0213H<br>
BL = exception/fault number (00H-1FH)<br>
CX:(E)DX = selector:offset of exception handler<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8021H</td><td>invalid value (BL not in range 00H-1FH)</td></tr>
<tr><td>8022H</td><td>invalid selector</td></tr>
</table>
<h2>Notes</h2>
<ul>
<li>CX:(E)DX does not specify a real-mode segment:offset. The reason
is that this function allows a client to set the address of an
exception handler which will receive control in protected mode when
the specified exception occurs in real mode (i.e. the host will
provide an implied mode switch for the purposes of servicing the
exception, then return to real mode after the handler exits). <p>
<li>Real mode exceptions are sent to the primary client of the virtual
machine. (See Appendix A: Glossary for definition of primary
client.)<p>
<li>Refer to the rules for descriptor usage in <a href="../descriptor-rules.html">Appendix D</a>.
</ul>

View File

@@ -0,0 +1,62 @@
<h2>Allocate Real Mode Callback Address
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Returns a unique real mode segment:offset, known as a "real mode
callback," that will transfer control from real mode to a protected
mode procedure. Callback addresses obtained with this function can be
passed by a protected mode program to a real mode application,
interrupt handler, device driver, or TSR, so that the real mode
program can call procedures within the protected mode program or
notify the protected mode program of an event.<p>
<b>Call With</b><br>
<img src="r/ax+D+esi+E+edi.gif" alt="" width=245 height=59><br>
AX = 0303H<br>
DS:(E)SI = selector:offset of protected mode procedure to call<br>
ES:(E)DI = selector:offset of 32H-byte buffer for real mode register
data structure to be used when calling callback routine.<p>
<b>Returns</b><br>
<img src="r/ax+cx+dx+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<br>
CX:DX = segment:offset of real mode callback<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8015H</td><td>callback unavailable</td></tr>
</table>
<h2>Notes</h2><ul>
<li>DPMI hosts must provide a minimum of 16 callback
addresses per client.<p>
<li>A descriptor may be allocated for each callback to hold the real
mode SS descriptor. Real mode callbacks are a limited system resource.
A client should use the Free Real Mode Callback Address function (<a
href="310304.html">Int 31H Function 0304H</a>) to release a callback
that it is no longer using.<p>
<li>For further information on writing real mode callback procedures,
see <a href="../ch4.6.html">that page</a>.<p>
<li>The contents of the real mode register data structure is
not valid after the function call, but only at the time
of the actual callback.<p>
</ul>

View File

@@ -0,0 +1,64 @@
<h2>Allocate Memory Block
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Allocates and commits a block of linear memory.<p>
<b>Call With</b><br>
<img src="r/ax+bx+cx.gif" alt="" width=245 height=59><br>
AX = 0501H<br>
BX:CX = size of block (bytes, must be nonzero)<p>
<b>Returns</b><br>
<img src="r/ax+bx+cx+si+di+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<br>
BX:CX = linear address of allocated memory block<br>
SI:DI = memory block handle (used to resize and free
block)<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8012H</td><td>linear memory unavailable</td></tr>
<tr><td>8013H</td><td>physical memory unavailable</td></tr>
<tr><td>8014H</td><td>backing store unavailable</td></tr>
<tr><td>8016H</td><td>handle unavailable</td></tr>
<tr><td>8021H</td><td>invalid value (BX:CX = 0)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>The allocated block is guaranteed to have at least paragraph
alignment.<p>
<li>This function always creates committed pages.<p>
<li>This function does not allocate any descriptors for the memory
block. It is the responsibility of the client to allocate and
initialize any descriptors needed to access the memory with additional
DPMI function calls.<p>
<li>Under DPMI hosts that support virtual memory, the memory block
will be allocated unlocked. The client can lock some or all of the
memory after it is allocated with the Lock Linear Region function (<a
href="310600.html">Int 31H Function 0600H</a>).<p>
<li>Under many DPMI hosts, allocations by this function are page
granular. This means, for example, that if the DPMI host uses a page
size of 4 KB (1000H), an allocation of 1001H bytes will actually
result in an allocation of 2000H bytes. Therefore, it is best to
always allocate memory in multiples of the unit of granularity (under
DPMI 0.9, use 4K bytes), which can be obtained with <a
href="310604.html">Int 31H Function 0604H</a>.<p>
</ul>

View File

@@ -0,0 +1,75 @@
<h2>Allocate Linear Memory Block
<img src="../1.0.gif" alt="[1.0]" width=22 height=17></h2>
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.<p>
<b>Call With</b><br>
<img src="r/ax+ebx+ecx+edx.gif" alt="" width=245 height=59><br>
AX = 0504H<br>
EBX = desired page-aligned linear address of memory
block,
or zero if linear address unspecified<br>
ECX = size of block (bytes, must be nonzero)<br>
EDX = flags
<blockquote><table border=1 cellspacing=0 cellpadding=4>
<tr><th>Bit</th><th>Significance</th></tr>
<tr><td align=center rowspan=2>0</td><td align=left>0 = create uncommitted pages</td></tr>
<tr><td align=left>1 = create committed pages</td></tr>
<tr><td align=center>1-31</td><td align=left>reserved, should be zero</td></tr>
</table></blockquote>
<b>Returns</b><br>
<img src="r/ax+ebx+esi+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<br>
EBX = linear address of memory block<br>
ESI = handle for memory block<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8001H</td><td>unsupported function (16-bit host)</td></tr>
<tr><td>8012H</td><td>linear memory unavailable</td></tr>
<tr><td>8013H</td><td>physical memory unavailable</td></tr>
<tr><td>8014H</td><td>backing store unavailable</td></tr>
<tr><td>8016H</td><td>handle unavailable</td></tr>
<tr><td>8021H</td><td>invalid value (ECX = 0)</td></tr>
<tr><td>8025H</td><td>invalid linear address (EBX not page aligned)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>A DPMI 1.0 host that is 16-bit only will not support this
function.<p>
<li>A 16-bit client of a 32-bit DPMI 1.0 host can use this
function.<p>
<li>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 <a
href="errors.html">error code</a> 8012H (linear memory
unavailable).<p>
<li><a href="310501.html">Int 31H Function 0501H</a>, 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. <p>
</ul>

View File

@@ -0,0 +1,96 @@
<h2>Map Device in Memory Block
<img src="../1.0.gif" alt="[1.0]" width=22 height=17></h2>
Maps the physical addresses assigned to a device onto the linear
addresses of a memory block previously allocated with <a
href="310504.html">Int 31H Function 0504H</a>.<p>
<b>Call With</b><br>
<img src="r/ax+ebx+ecx+edx+esi.gif" alt="" width=245 height=59><br>
AX = 0508H<br>
ESI = memory block handle<br>
EBX = offset within memory block of page(s) to be
mapped (must be page-aligned)<br>
ECX = number of pages to map<br>
EDX = physical address of device (must be
page-aligned)<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8001H</td><td>unsupported function (Device Mapping</td></tr>
Capability not supported)
<tr><td>8003H</td><td>system integrity (invalid device address)</td></tr>
<tr><td>8023H</td><td>invalid handle (in ESI)</td></tr>
<tr><td>8025H</td><td>invalid linear address (specified range
is not within specified block or EBX/EDX
is not page-aligned)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>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.<p>
<li>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.<p>
<li>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.<p>
<li>All pages created by this call have the mapped bit (bit 2) set in
the attributes returned by the Get Page Attributes function (<a
href="310506.html">Int 31H Function 0506H</a>).<p>
<li>This function differs from the Create Physical Address Mapping
function (<a href="310800.html">Int 31H Function 0800H</a>) 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.<p>
<li>Unlike <a href="310800.html">Int 31H Function 0800H</a>, 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.<p>
<li>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.<p>
<li>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.<p>
<li>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.<p>
</ul>

View File

@@ -0,0 +1,100 @@
<h2>Map Conventional Memory in Memory Block
<img src="../1.0.gif" alt="[1.0]" width=22 height=17></h2>
Aliases linear addresses below the 1 MB boundary onto the linear
addresses of a memory block previously allocated with <a
href="310504.html">Int 31H Function 0504H</a>.<p>
<b>Call With</b><br>
<img src="r/ax+ebx+ecx+edx+esi.gif" alt="" width=245 height=59><br>
AX = 0509H<br>
ESI = memory block handle<br>
EBX = offset within memory block of page(s) to be
mapped (must be page-aligned)<br>
ECX = number of pages to map<br>
EDX = linear address of conventional memory (must be
page-aligned)<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8001H</td><td>unsupported function (Conventional Memory
Mapping Capability not supported)</td></tr>
<tr><td>8003H</td><td>system integrity (invalid conventional
memory address)</td></tr>
<tr><td>8023H</td><td>invalid handle (in ESI)</td></tr>
<tr><td>8025H</td><td>invalid linear address (specified range
is not within specified block, or EBX/EDX
is not page aligned)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>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.<p>
<li>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.<p>
<li>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.<p>
<li>A client may only map conventional memory that it already owns;
i.e. memory which the client previously allocated with <a
href="310100.html">Int 31H Function 0100H</a> or by calling DOS's Int
21H Function 48H directly via the translation services.<p>
<li>All pages created by this call have the mapped bit (bit 2) set in
the attributes returned by the Get Page Attributes function (<a
href="310506.html">Int 31H Function 0506H</a>).<p>
<li>DPMI hosts that do not implement virtual memory can support this
function by simply copying page table entries. The entries must be
marked as mapped so that the host knows not to free up those physical
pages when the memory block is freed.<p>
<li>DPMI hosts that provide virtual memory must implement some form of
page aliasing in order to support this function.<p>
<li>The function can provide a large contiguous memory space without
virtual memory support. <p>
<li>Implementors of DPMI hosts which do not provide virtual memory are
encouraged to support this function. Without this function,
conventional memory may be inaccessible to a 32-bit nonsegmented
client, because the client may need contiguous linear memory for its
code and data. 32-bit clients can always guarantee that conventional
memory is not wasted with the following strategy:<ul>
<li>Call DOS to allocate any free conventional memory
<li>If the DPMI host supports virtual memory, call the Mark Real Mode
Region Pageable function (<a href="310602.html">Int 31H Function
0602H</a>) to ensure that the host has not locked down conventional
memory.
<li>If the host does not support virtual memory but supports the Map
Conventional Memory function (<a href="310509.html">Int 31H Function
0509H</a>), allocate a memory block with uncommitted pages, then use
<a href="310509.html">Function 0509H</a> to make the physical memory
allocated below 640 KB addressable in the memory block, and therefore
useable by the 32-bit application program. </ul><p>
</ul>

View File

@@ -0,0 +1,86 @@
<h2>Mark Real Mode Region as Pageable
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Advises the DPMI host that the specified memory below the 1 MB
boundary may be paged to disk.<p>
<b>Call With</b><br>
<img src="r/ax+bx+cx+si+di.gif" alt="" width=245 height=59><br>
AX = 0602H<br>
BX:CX = starting linear address of memory to mark as
pageable<br>
SI:DI = size of region to be marked (bytes)<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8002H</td><td>invalid state (region already marked as pageable)</td></tr>
<tr><td>8025H</td><td>invalid linear address (region is above 1 MB boundary)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>If the function returns an error, none of the memory has been
marked as pageable.<p>
<li>If the specified region overlaps part of a page at the beginning
or end of the region, the page(s) will not be marked as pageable.<p>
<li>Pageability information for a real mode region is maintained as a
binary state, not a count. Therefore, multiple calls to this function
for the same region have no effect.<p>
<li>For compatibility with DPMI version 0.9 hosts, a client must call
the Relock Real Mode Region function (<a href="310603.html">Int 31H
Function 0603H</a>) to relock the memory region before terminating.
Memory that remains unlocked after the client has terminated could
result in fatal page faults when another program is executed in the
same address space. DPMI 1.0 hosts automatically relock real mode
memory at client termination.<p>
<li>Under some DPMI hosts, all conventional memory may be locked by
default. If a protected mode program is using memory in the first
megabyte of address space, it is recommended that this function be
used to turn off automatic page locking for regions of memory that
will not be touched at interrupt time.<p>
<li>The client must not mark memory as pageable in regions that it
does not own; i.e. it may only mark as pageable memory that it has
previously allocated with <a href="310100.html">Int 31H Function
0100H</a> or by a direct call to DOS via the translation functions.
For example, marking all free DOS memory as pageable under some DPMI
hosts could cause a page fault to occur while inside of DOS, resulting
in a crash. Also, a client should not mark the DPMI host data area as
pageable.<p>
<li>Note that address space marked as pageable by this function can
still be locked using the Lock Linear Region function (<a
href="310600.html">Int 31H Function 0600H</a>). This function is just
an advisory service to allow memory that does not need to be locked to
be paged out; it disables any automatic locking of real mode memory
performed by the DPMI host.<p>
<li>This function is ignored by DPMI implementations that do not
support virtual memory; the function will return the Carry flag clear
to indicate success, but has no other effect. DPMI hosts which
support virtual memory may also choose to ignore this function, but
such hosts must be able to handle page faults transparently at
arbitrary points during a client's execution, including within
interrupt and exception handlers.<p>
</ul>

View File

@@ -0,0 +1,60 @@
<h2>Relock Real Mode Region
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Relocks a memory region that was previously declared as pageable with
the Mark Real Mode Region as Pageable function (<a
href="310602.html">Int 31H Function 0602H</a>).<p>
<b>Call With</b><br>
<img src="r/ax+bx+cx+si+di.gif" alt="" width=245 height=59><br>
AX = 0603H<br>
BX:CX = starting linear address of memory to relock<br>
SI:DI = size of region to relock (bytes)<p>
<b>Returns</b><br>
<img src="r/ax+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8002H</td><td>invalid state (region not marked as
pageable)</td></tr>
<tr><td>8013H</td><td>physical memory unavailable</td></tr>
<tr><td>8025H</td><td>invalid linear address (region is above 1
MB boundary)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>If the function returns an error, none of the memory has been
relocked.<p>
<li>If the specified region overlaps part of a page at the beginning
or end of the region, the page(s) will not be relocked.<p>
<li>This function is ignored by DPMI implementations that do not
support virtual memory; the function will return the Carry flag clear
to indicate success, but has no other effect. DPMI hosts which
support virtual memory may also choose to ignore this function, but
such hosts must be able to handle page faults transparently at
arbitrary points during a client's execution, including within
interrupt and exception handlers.<p>
<li>If <a href="310602.html">Function 0602H</a> is implemented as a
"no-operation" on a particular DPMI host, this function will likewise
do nothing. In other words, this function should not be used to lock
memory, but only to restore the default state of the host's
conventional memory locking.<p>
</ul>

View File

@@ -0,0 +1,91 @@
<h2>Physical Address Mapping
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Converts a physical address into a linear address. This function
allows device drivers running under DPMI hosts which use paging to
reach physical memory that is associated with their devices above the
1 MB boundary Examples of such devices are the Weitek numeric
coprocessor (usually mapped at 3 GB), buffers that hold scanner bit
maps, and high-end displays that can be configured to make display
memory appear in extended memory.<p>
<b>Call With</b><br>
<img src="r/ax+bx+cx+si+di.gif" alt="" width=245 height=59><br>
AX = 0800H<br>
BX:CX = physical address of memory<br>
SI:DI = size of region to map (bytes)<p>
<b>Returns</b><br>
<img src="r/ax+bx+cx+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<br>
BX:CX = linear address that can be used to access the
physical memory<br>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8003H</td><td>system integrity (DPMI host memory
region)</td></tr>
<tr><td>8021H</td><td>invalid value (address is below 1 MB
boundary)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>It is the caller's responsibility to allocate and initialize a
descriptor for access to the memory.<p>
<li>This function should only be used by clients that absolutely
require direct access to a memory mapped device at physical addresses
above 1 MB. Clients should not use this function to access memory
below the 1 MB boundary (the real mode addressable region). See also
<a href="310200.html">Int 31H Functions 0002H</a>, <a
href="310508.html">0508H</a>, and <a href="310509.html">0509H</a>.<p>
<li>When this function is called, the DPMI host either creates page
table entries that directly map the physical addresses requested and
returns the linear address of the created page table entries, or else
just returns the linear address of the memory region that is already
used to map the requested device. For example, if the client attempts
to map a Weitek coprocessor and the host already has a linear region
set up to map the Weitek chip and virtualize it, it would simply
return the linear address of the existing region. If the host does
not virtualize the Weitek chip, it would create 16 page table entries
that map the 64 KB Weitek address space and return a linear address
corresponding to the new page table entries.<p>
<li>If the host is not virtualizing the device, it must disable any
memory caching on the mapped pages; in particular, on the 80486 the
host must set the PCD (page cache disable) bit in the page table
entries.<p>
<li>The host is permitted to fail any memory mapping call. However,
the host should support this function whenever possible, to achieve
compatibility with application programs that use memory-mapped devices
of which the host is not aware. Useful guidelines are that the host
should fail any attempt to map addresses below 1 MB, or addresses
which the host considers to be general-purpose RAM memory. Attempts
to map any other physical address should succeed, since the host
should either (a) already know about the device and be able to return
a linear address used to access the device, or (b) assume the program
is attempting to map a legitimate device of which the host has no
knowledge.<p>
<li>Programs and device drivers which need to perform DMA I/O to
physical addresses in a virtualized hardware environment should use
the Virtual DMA Services (see the Glossary entry for the Virtual DMA
Services Specification). Also see page 10 of the DPMI execution
environment section.<p>
</ul>

View File

@@ -0,0 +1,54 @@
<h2>Set Debug Watchpoint
<img src="../0.9.gif" alt="[0.9]" width=22 height=17></h2>
Sets a debug watchpoint at the specified linear address.<p>
<b>Call With</b><br>
<img src="r/ax+bx+cx+dh+dl.gif" alt="" width=245 height=59><br>
AX = 0B00H<br>
BX:CX = linear address of watchpoint<br>
DL = size of watchpoint (1, 2, or 4 bytes)<br>
DH = type of watchpoint
<blockquote><table border=1 cellspacing=0 cellpadding=4>
<tr><th>Value</th><th>Breakpoint Type</th></tr>
<tr><td align=center>0</td><td align=left>execute</td></tr>
<tr><td align=center>1</td><td align=left>write</td></tr>
<tr><td align=center>2</td><td align=left>read/write</td></tr>
</table></blockquote>
<b>Returns</b><br>
<img src="r/ax+bx+c.gif" alt="" width=245 height=59><br>
<i>if function successful</i><br>
Carry flag = clear<br>
BX = watchpoint handle<p>
<i>if function unsuccessful</i><br>
Carry flag = set<br>
AX = <a href="errors.html">error code</a>
<table border=1 cellspacing=0 cellpadding=4>
<tr><td>8016H</td><td>too many breakpoints</td></tr>
<tr><td>8021H</td><td>invalid value (in DL or DH)</td></tr>
<tr><td>8025H</td><td>invalid linear address (linear address
not mapped or alignment error)</td></tr>
</table>
<h2>Notes</h2><ul>
<li>Under DPMI 1.0, the handle will be in the range 0-14. Under DPMI
0.9, the handle range is not limited.<p>
<li>The watchpoint handle corresponds to the bit number in the Virtual
DR6 returned in the exception frame (see <a href="310212.html">Int 31H
Function 0212H</a> and page 18 of the DPMI spec).<p>
</ul>

View File

@@ -0,0 +1,51 @@
<h2>Terminate and Stay Resident
<img src="../1.0.gif" alt="[1.0]" width=22 height=17></h2>
A resident service provider uses this function after its
initialization to terminate execution while leaving its protected mode
memory (and optionally some real mode memory) allocated.<p>
<b>Call With</b><br>
<img src="r/ax+bl+dx.gif" alt="" width=245 height=59><br>
AX = 0C01H<br>
BL = return code<br>
DX = number of paragraphs (16-byte blocks) of DOS
memory to reserve<p>
<b>Returns</b><br>
Nothing (this call never returns)
<h2>Notes</h2><ul>
<li>This function should only be used by DPMI clients which only
provide resident services to other DPMI protected mode clients. If
the objective is only to provide resident services to real mode
programs, the client should use the DPMI translation service <a
href="310300.html">Int 31H Function 0300H</a> to invoke DOS's Int 21H
Function 31H directly.<p.
<li>The value in DX only specifies the size of DOS allocated memory to
reserve. Any protected mode memory owned by the program remains
allocated unless it is explicitly released before executing this
function. Note that the value in DX must either be 0 or a minimum of
6. If DX is 0, the DPMI host executes a DOS real mode terminate
function (Int 21H Function 4CH), and no real mode memory is reserved.
If DX is nonzero, the DPMI host requests the DOS real mode
terminate-and-stay-resident function (Int 21H Function 31H).<p>
<li>If the client has not made a prior call to <a
href="310c00.html">Int 31H Function 0C00H</a>, the client will simply
be terminated.<p>
<li>For further details on programming of resident service providers,
see <a href="../ch4.8.html">that page</a>.<p>
</ul>

View File

@@ -0,0 +1,141 @@
Note that DPMI 0.9 hosts are <em>not</em> required to return a valid
error code in AX. You may only rely on the carry flag being set if an
error occurred. <p>
Nearly all Int 31H function calls can fail, either because of client
errors, unavailable resources, or internal host problems. Most
failures due to client errors and all failures due to unavailable
resources are reported to the client via error codes. Some client
errors, such as passing an invalid pointer in a function call, may
cause the host to fault; the client can detect these events by
installing an exception handler. <p>
Internal host errors are handled in a host-specific manner and
generally not reported to clients with an error code. The only
exception to this is the case when a host cannot allocate internal
resources. Any Int 31H function is capable of returning error code
8010H to indicate this condition.<p>
A DPMI 1.0 host signals an error by returning from a function with the
Carry flag set and an error code in AX. If the error code has bit 15
clear (0), the DPMI host is passing a DOS error code through to the
client; for a list of these error codes, consult a DOS technical
reference. If the error code has bit 15 set (1), it is generated
within the DPMI host, and is interpreted according to the list below.
All DPMI 1.0 hosts are required to check for the error conditions
listed in this specification, and must return the error codes that are
documented for each function.<p>
If Int 31H is invoked with an function number that is not defined in
this specification, the DPMI host will return the "Unsupported
Function" error code 8001H. The table lists all defined error codes
and their messages. Unused error codes are reserved for the later
versions of the DPMI spcifications.<p>
<table border=1 cellspacing=0 cellpadding=4>
<tr><th>Error Code</th>
<th>Name</th>
<th>Explanation</th></tr>
<tr><td>0007H</td>
<td align=left>Memory configuration blocks damaged</td>
<td align=left>The operating system has detected corruption in the real-mode memory arena.</td></tr>
<tr><td>0008H</td>
<td align=left>Insufficient memory</td>
<td align=left>There is not enough real-mode memory to satisfy the request.</td></tr>
<tr><td>0009H</td>
<td align=left>Incorrect memory segment specified</td>
<td align=left>The segment value specified was not one provided by the operating system</td></tr>
<tr><td>8001H</td>
<td align=left>Unsupported function</td>
<td align=left>Returned in response to any function call which is not implemented by this host, because the requested function is either undefined or optional.</td></tr>
<tr><td>8002H</td>
<td align=left>Invalid state</td>
<td align=left>Some object is in the wrong state for the requested operation.</td></tr>
<tr><td>8003H</td>
<td align=left>System integrity</td>
<td align=left>The requested operation would endanger system integrity, e.g., a request to map linear addresses onto system code or data.</td></tr>
<tr><td>8004H</td>
<td align=left>Deadlock</td>
<td align=left>Host detected a deadlock situation.</td></tr>
<tr><td>8005H</td>
<td align=left>Request cancelled</td>
<td align=left>A pending serialization request was cancelled.</td></tr>
<tr><td>8010H</td>
<td align=left>Resource Unavailable</td>
<td align=left>The DPMI host cannot allocate internal resources to complete an operation.</td></tr>
<tr><td>8011H</td>
<td align=left>Descriptor unavailable</td>
<td align=left>Host is unable to allocate a descriptor.</td></tr>
<tr><td>8012H</td>
<td align=left>Linear memory unavailable</td>
<td align=left>Host is unable to allocate the required linear memory.</td></tr>
<tr><td>8013H</td>
<td align=left>Physical memory unavailable</td>
<td align=left>Host is unable to allocate the required physical memory.</td></tr>
<tr><td>8014H</td>
<td align=left>Backing store unavailable</td>
<td align=left>Host is unable to allocate the required backing store.</td></tr>
<tr><td>8015H</td>
<td align=left>Callback unavailable</td>
<td align=left>Host is unable to allocate the required callback address.</td></tr>
<tr><td>8016H</td>
<td align=left>Handle unavailable</td>
<td align=left>Host is unable to allocate the required handle.</td></tr>
<tr><td>8017H</td>
<td align=left>Lock count exceeded</td>
<td align=left>A locking operation exceeds the maximum count maintained by the host.</td></tr>
<tr><td>8018H</td>
<td align=left>Resource owned exclusively</td>
<td align=left>A request for serialization of a shared memory block could not be satisfied because it is already serialized exclusively by another client.</td></tr>
<tr><td>8019H</td>
<td align=left>Resource owned shared</td>
<td align=left>A request for exclusive serialization of a shared memory block could not be satisfied because it is already serialized shared by another client.</td></tr>
<tr><td>8021H</td>
<td align=left>Invalid value</td>
<td align=left>A numeric or flag parameter has an invalid value.</td></tr>
<tr><td>8022H</td>
<td align=left>Invalid selector</td>
<td align=left>A selector does not correspond to a valid descriptor.</td></tr>
<tr><td>8023H</td>
<td align=left>Invalid handle</td>
<td align=left>A handle parameter is invalid.</td></tr>
<tr><td>8024H</td>
<td align=left>Invalid callback</td>
<td align=left>A callback parameter is invalid.</td></tr>
<tr><td>8025H</td>
<td align=left>Invalid linear address</td>
<td align=left>A linear address range (either supplied as a parameter or implied by the call) is invalid.</td></tr>
<tr><td>8026H</td>
<td align=left>Invalid request</td>
<td align=left>The request is not supported by the underlying hardware.</td></tr>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB