home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / sys_util / dpmiv1.zip / DPMIV1.TXT
Text File  |  1993-08-18  |  139KB  |  4,058 lines

  1. Int 2FH Function 1680H [1.0]
  2.  
  3. Release Current Virtual Machine's Time Slice
  4.  
  5. Called by a client program to indicate that the program is
  6. idle (for example, waiting for keyboard input).  This allows
  7. the DPMI host to pass the CPU to other clients, or take
  8. power-conserving measures on laptop and notebook computers.
  9.  
  10. Call With:
  11.  
  12.    AX     = 1680H
  13.  
  14. Returns:
  15.  
  16.    if function supported by host
  17.    AL     = 0
  18.  
  19.    if function not supported by host
  20.    AL     = unchanged (80H)
  21.  
  22. Notes:
  23.  
  24. o  This function is not specific to DPMI hosts.  Some
  25.    operating systems will recognize this call for programs
  26.    running in real mode.  Programmers are encouraged to use
  27.    this call in all DOS and DPMI-client programs.  All DPMI
  28.    hosts will hook Int 2FH and so a DPMI client can use this
  29.    API without any other precautions.  Non-DPMI programs
  30.    that can run on DOS 2.xx or earlier should make sure that
  31.    the Int 2FH vector is non-zero before executing the Int
  32.    2FH.
  33.  
  34. o  When an application calls this function it will regain
  35.    control at intervals, so it should continue to re-issue
  36.    this function call so long as it has nothing to do.
  37.  
  38. o  DPMI client and application vendors are encouraged to use
  39.    this function.  It can significantly improve the
  40.    performance of a DOS-based multitasking host.
  41. Int 2FH Function 1686H [0.9]
  42.  
  43. Get CPU Mode
  44.  
  45. Returns information about the current CPU mode.  Programs
  46. which only execute in protected mode do not need to call
  47. this function.
  48.  
  49. Call With:
  50.  
  51.    AX     = 1686H
  52.  
  53. Returns:
  54.  
  55.    if executing in protected mode
  56.    AX     = 0
  57.  
  58.    if executing in real mode or Virtual 86 mode
  59.    AX     = nonzero
  60.  
  61. Notes:
  62.  
  63. o  Some environments support programs or libraries that can
  64.    execute in either real or protected mode (bimodal code). 
  65.    This function is supplied so that such programs can
  66.    detect at run time whether they are running in protected
  67.    mode and make use of system facilities accordingly.
  68. o  This function should not be used to determine if a DPMI
  69.    host is present.  A client should make sure that DPMI
  70.    services are available before calling this function;
  71.    otherwise, the results returned by the function may not
  72.    be valid.
  73.  
  74.  
  75. Int 2FH Function 1687H [0.9]
  76.  
  77. Obtain Real-to-Protected Mode Switch Entry Point
  78.  
  79. This function can be called in real mode only to test for
  80. the presence of a DPMI host, and to obtain an address of a
  81. mode switch routine that can be called to begin execution in
  82. protected mode.
  83.  
  84. Call With:
  85.  
  86.    AX     = 1687h
  87.  
  88. Returns:
  89.  
  90.    if function successful
  91.    AX     = 0
  92.    BX     = flags
  93.            Bit    Significance
  94.            0      0 = 32-bit programs are not supported
  95.                   1 = 32-bit programs are supported
  96.            1-15   not used
  97.    CL     = processor type
  98.            02H = 80286
  99.            03H = 80386
  100.            04H = 80486
  101.            05H-FFH  Reserved for future Intel processors
  102.    DH     = DPMI major version as a decimal number
  103.            (represented in binary)
  104.    DL     = DPMI minor version as a decimal number
  105.            (represented in binary)
  106.    SI     = number of paragraphs required for DPMI host
  107.            private data (may be 0)
  108.    ES:DI  = segment:offset of procedure to call to enter
  109.            protected mode
  110.  
  111.    if function unsuccessful (no DPMI host present)
  112.    AX     = nonzero
  113.  
  114. Notes:
  115.  
  116. o  The entry point returned by Int 2FH Function 1687H is
  117.    only called for the first switch to protected mode by a
  118.    DPMI client.  For further details on the protocol for
  119.    switching to protected mode and the environment after
  120.    switching to protected mode, see page 22.
  121.  
  122. o  Under DPMI hosts, the major version number is returned in
  123.    DH and the minor version number is returned in DL. There
  124.    are two decimal digits for the minor version number with
  125.    the least-significant digit representing the revision
  126.    number of the minor version number. Under DPMI version
  127.    0.9 hosts, DH is returned as 0, and DL is returned as
  128.    decimal 90 (5AH). In hypothetical DPMI version 2.3, DH
  129.    would be returned as 2 and DL would be returned as 30
  130.    (1EH).
  131.  
  132.  
  133.  
  134. Int 2FH Function 168AH [1.0]
  135.  
  136. Get Vendor-Specific API Entry Point
  137.  
  138. Returns an address which can be called to use host-specific
  139. extensions to the standard set of DPMI functions. This
  140. function is available only in protected mode.
  141.  
  142. Call With:
  143.  
  144.    AX     = 168AH
  145.    DS:(E)SI= selector:offset of ASCIIZ (null-terminated)
  146.            string identifying the DPMI host vendor
  147.  
  148. Returns:
  149.  
  150.    if function successful
  151.    AL     = 0
  152.    ES:(E)DI= extended API entry point
  153.  
  154.    and DS, FS, GS, EAX, EBX, ECX, EDX, ESI, and EBP are
  155.            preserved.
  156.  
  157.    if function unsuccessful
  158.    AL     = unchanged (8AH)
  159.  
  160. Notes:
  161.  
  162. o  The ASCIIZ string specifies a host vendor name or some
  163.    other unique identifier to obtain a specific extension
  164.    entry point.  The string comparison used to look up the
  165.    API entry point is case-sensitive.
  166. o  Clients must use a FAR CALL to reach the extended API
  167.    entry point.
  168. o  All extended API parameters are specified by the vendor.
  169. o  DPMI 1.0 clients should use this function in preference
  170.    to Int 31H Function 0A00H.  This method of API extension
  171.    is preferable to the Int 31H extension as it avoids the
  172.    creation of a long (and consequently slow) chain of Int
  173.    31H handlers which would slow down time-critical DPMI
  174.    functions. Note that although this function was not
  175.    documented for DPMI 0.9, it will work under any DPMI 0.9
  176.    host.
  177. Int 31H Function 0000H [0.9]
  178.  
  179. Allocate LDT Descriptors
  180.  
  181. Allocates one or more descriptors in the task's Local
  182. Descriptor Table (LDT).  The descriptor(s) allocated must be
  183. initialized by the application with other function calls.
  184.  
  185. Call With:
  186.  
  187.    AX     = 0000H
  188.    CX     = number of descriptors to allocate
  189.  
  190. Returns:
  191.  
  192.    if function successful
  193.    Carry flag= clear
  194.    AX     = base selector
  195.  
  196.    if function unsuccessful
  197.    Carry flag= set
  198.    AX     = error code
  199.            8011H   descriptor unavailable
  200.  
  201. Notes:
  202.  
  203. o  If more than one descriptor was requested, the function
  204.    returns a base selector referencing the first of a
  205.    contiguous array of descriptors.  The selector values for
  206.    subsequent descriptors in the array can be calculated by
  207.    adding the value returned by Int 31H Function 0003H.
  208. o  The allocated descriptor(s) will be set to "data" with
  209.    the present bit set and a base and limit of zero. The
  210.    privilege level of the descriptor(s) will match the
  211.    application's code segment privilege level.
  212.  
  213. o   Refer to the rules for descriptor usage in Appendix D.
  214.  
  215. Int 31H Function 0001H [0.9]
  216.  
  217. Free LDT Descriptor
  218.  
  219. Frees an LDT descriptor.
  220.  
  221. Call With:
  222.  
  223.    AX     = 0001H
  224.    BX     = selector for the descriptor to free
  225.  
  226. Returns:
  227.  
  228.    if function successful
  229.    Carry flag= clear
  230.  
  231.    if function unsuccessful
  232.    Carry flag= set
  233.    AX     = error code
  234.            8022Hinvalid selector
  235.  
  236. Notes:
  237.  
  238. o  Each descriptor allocated with Int 31H Function 0000H
  239.    must be freed individually with this function, even if it
  240.    was previously allocated as part of a contiguous array of
  241.    descriptors.
  242. o  Under DPMI 1.0 hosts, any segment registers which contain
  243.    the selector being freed are zeroed by this function.
  244. o  Refer to the rules for descriptor usage in Appendix D.
  245. Int 31H Function 0002H [0.9]
  246.  
  247. Segment to Descriptor
  248.  
  249. Maps a real mode segment (paragraph) address onto an LDT
  250. descriptor that can be used by a protected mode program to
  251. access the same memory.
  252.  
  253. Call With:
  254.  
  255.    AX     = 0002H
  256.    BX     = real mode segment address
  257.  
  258. Returns:
  259.  
  260.    if function successful
  261.    Carry flag= clear
  262.    AX     = selector for real mode segment
  263.  
  264.    if function unsuccessful
  265.    Carry flag= set
  266.    AX     = error code
  267.            8011H   descriptor unavailable
  268.  
  269. Notes:
  270.  
  271. o  The descriptor's limit will be set to 64 KB.
  272. o  Multiple calls to this function with the same segment
  273.    address will return the same selector.
  274. o  The intent of this function is to provide clients with
  275.    easy access to commonly used real mode segments such as
  276.    the BIOS data area at segment 0040H and the video refresh
  277.    buffers at segments A000H, B000H, and B800H.  Clients
  278.    should not call this function to obtain descriptors to
  279.    private data areas.
  280. o  Descriptors created by this function can never be
  281.    modified or freed.  For this reason, the function should
  282.    be used sparingly.  Clients which need to examine various
  283.    real mode addresses using the same selector should
  284.    allocate a descriptor with Int 31H Function 0000H and
  285.    change the base address in the descriptor as necessary,
  286.    using the Set Segment Base Address function (Int 31H
  287.    Function 0007H).
  288.  
  289. o   Refer to the rules for descriptor usage in Appendix D.
  290. Int 31H Function 0003H [0.9]
  291.  
  292. Get Selector Increment Value
  293.  
  294. The DPMI functions Allocate LDT Descriptors (Int 31H
  295. Function 0000H) and Allocate DOS Memory Block (Int 31H
  296. Function 0100H) can allocate 
  297. an array of contiguous descriptors, but only return a
  298. selector for the first descriptor.  The value returned by
  299. this function can be used to calculate the selectors for
  300. subsequent descriptors in the array.
  301.  
  302. Call With:
  303.  
  304.    AX     = 0003H
  305.  
  306. Returns:
  307.  
  308.    Carry flag= clear (this function always succeeds)
  309.    AX     = selector increment value
  310.  
  311. Notes:
  312.  
  313. o  The increment value is always a power of two.
  314.  
  315. Int 31H Function 0004H [0.9]
  316.  
  317. Reserved
  318.  
  319. DPMI Function 0004H is reserved for historical reasons and
  320. should not be called.
  321. Int 31H Function 0005H [0.9]
  322.  
  323. Reserved
  324.  
  325. DPMI Function 0005H is reserved for historical reasons and
  326. should not be called.
  327. Int 31H Function 0006H [0.9]
  328.  
  329. Get Segment Base Address
  330.  
  331. Returns the 32-bit linear base address from the LDT
  332. descriptor for the specified segment.
  333.  
  334. Call With:
  335.  
  336.    AX     = 0006H
  337.    BX     = selector
  338.  
  339. Returns:
  340.  
  341.    if function successful
  342.    Carry flag= clear
  343.    CX:DX  = 32-bit linear base address of segment
  344.  
  345.    if function unsuccessful
  346.    Carry flag= set
  347.    AX     = error code
  348.            8022H   invalid selector
  349.  
  350. Notes:
  351.  
  352. o  Client programs must use the LSL instruction to query the
  353.    limit for a descriptor.  Note that on 80386 machines, the
  354.    client must use the 32-bit form of LSL if the segment
  355.    size is greater than 64 KB.
  356. o  Refer to the rules for descriptor usage in Appendix D.
  357.  
  358. Int 31H Function 0007H [0.9]
  359.  
  360. Set Segment Base Address
  361.  
  362. Sets the 32-bit linear base address field in the LDT
  363. descriptor for the specified segment.
  364.  
  365. Call With:
  366.  
  367.    AX     = 0007H
  368.    BX     = selector
  369.    CX:DX  = 32-bit linear base address of segment
  370.  
  371. Returns:
  372.  
  373.    if function successful
  374.    Carry flag= clear
  375.  
  376.    if function unsuccessful
  377.    Carry flag= set
  378.    AX     = error code
  379.            8022H   invalid selector
  380.            8025H   invalid linear address (changing the base
  381.                    would cause the descriptor to reference a
  382.                    linear address range outside that allowed
  383.                    for DPMI clients)
  384.  
  385. Notes:
  386.  
  387. o  A DPMI 1.0 host will automatically reload any segment
  388.    register which contains the selector specified in
  389.    register BX.  It is suggested that DPMI 0.9 hosts also
  390.    implement this.
  391. o  Refer to the rules for descriptor usage in Appendix D.
  392.  
  393. Int 31H Function 0008H [0.9]
  394.  
  395. Set Segment Limit
  396.  
  397. Sets the limit field in the LDT descriptor for the specified
  398. segment.
  399.  
  400. Call With:
  401.  
  402.    AX     = 0008H
  403.    BX     = selector
  404.    CX:DX  = 32-bit segment limit
  405.  
  406. Returns:
  407.  
  408.    if function successful
  409.    Carry flag= clear
  410.  
  411.    if function unsuccessful
  412.    Carry flag= set
  413.    AX     = error code
  414.            8021H   invalid value (CX <> 0 on a 16-bit DPMI
  415.                    host; or the limit is greater than 1 MB,
  416.                    but the low twelve bits are not set)
  417.            8022H   invalid selector
  418.            8025H   invalid linear address (changing the
  419.                    limit would cause the descriptor to
  420.                    reference a linear address range outside
  421.                    that allowed for DPMI clients.)
  422.  
  423. Notes:
  424.  
  425. o  The value supplied to the function in CX:DX is the byte
  426.    length of the segment-1 (i.e., the value returned by the
  427.    LSL instruction).
  428. o  Segment limits greater than or equal to 1 MB must be
  429.    page-aligned.  That is, limits greater than 1 MB must
  430.    have the low 12 bits set.
  431. o  This function has an implicit effect on  the "G"
  432.    (granularity) bit in an 80386 descriptor's extended
  433.    access rights/type byte; i.e., it is the host's
  434.    responsibility to set the "G" bit correctly.
  435. o  Client programs must use the LSL instruction to query the
  436.    limit for a descriptor.  Note that on 80386 machines, the
  437.    client must use the 32-bit form of LSL if the segment
  438.    size is greater than 64 KB.
  439. o  A DPMI 1.0 host will reload any segment registers which
  440.    contain the selector specified in register BX.  It is
  441.    suggested that DPMI 0.9 hosts also implement this.
  442. o  Refer to the rules for descriptor usage in Appendix D.
  443.  
  444. Int 31H Function 0009H [0.9]
  445.  
  446. Set Descriptor Access Rights
  447.  
  448. Modifies the access rights and type fields in the LDT
  449. descriptor for the specified segment.
  450.  
  451. Call With:
  452.  
  453.    AX     = 0009H
  454.    BX     = selector
  455.    CL     = access rights/type byte
  456.    CH     = 80386 extended access rights/type byte
  457.  
  458. Returns:
  459.  
  460.    if function successful
  461.    Carry flag= clear
  462.  
  463.    if function unsuccessful
  464.    Carry flag= set
  465.    AX     = error code
  466.            8021H   invalid value (access rights/type bytes
  467.                    invalid)
  468.            8022H   invalid selector
  469.            8025H   invalid linear address (changing the
  470.                    access rights/type bytes would cause the
  471.                    descriptor to reference a linear address
  472.                    range outside that allowed for DPMI
  473.                    clients.)
  474.  
  475. Notes:
  476.  
  477. o  The access rights/type byte passed to the function in CL
  478.    has the following format:
  479.  
  480.    +---+---+---+---+---+---+---+---+
  481.    | P |  DPL  | 1 |C/D|E/C|W/R| A |
  482.    +-+-+---+---+-+-+-+-+-+-+-+-+-+-+
  483.    |     |     |   |   |   |   |
  484.    |     |     |   |   |   |   +- 0=not accessed, 1=accessed
  485.    |     |     |   |   |   +----- data: 0=read,
  486.    1=>read/write
  487.    |     |     |   |   |          code: must be 1 (readable)
  488.    |     |     |   |   +--------- data: 0=expand-up,
  489.    1=expand-down
  490.    |     |     |   |              code: must be 0
  491.    (non-conforming)
  492.    |     |     |   +------------- 0=data, 1=code
  493.    |     |     +----------------- must be 1
  494.    |     +----------------------- must equal caller's CPL
  495.    +----------------------------- 0=absent, 1=present
  496.  
  497.    If the Present bit is not set in the descriptor, the DPMI
  498.    host allows any values except in the DPL and "must be 1"
  499.    bit fields.
  500.  
  501. o  On 80386 (and later) machines, the DPMI host interprets
  502.    the value passed to the function in CH as follows:
  503.  
  504.    +---+---+---+---+---+---+---+---+
  505.    | G |B/D| 0 |Avl|    Reserved   |
  506.    +-+-+-+-+-+-+-+-+---+---+---+---+
  507.    |   |   |   |         |
  508.    |   |   |   |         +-- ignored
  509.    |   |   |   +------------ can be 0 or 1
  510.    |   |   +---------------- must be 0
  511.    |   +-------------------- 0=default 16-bit, 1=default
  512.    32-bit
  513.    +------------------------ 0=byte granular, 1=page
  514.    granular
  515.  
  516. o  A DPMI 1.0 host will reload any segment registers which
  517.    contain the selector specified in register BX. It is
  518.    suggested that DPMI 0.9 hosts also implement this.
  519. o  Client programs should use the LAR instruction to examine
  520.    the access rights of a descriptor.
  521. o  Refer to the rules for descriptor usage in Appendix D.
  522. Int 31H Function 000AH [0.9]
  523.  
  524. Create Alias Descriptor
  525.  
  526. Creates a new LDT data descriptor that has the same base and
  527. limit as the specified descriptor.
  528.  
  529. Call With:
  530.  
  531.    AX     = 000AH
  532.    BX     = selector
  533.  
  534. Returns:
  535.  
  536.    if function successful
  537.    Carry flag= clear
  538.    AX     = data selector (alias)
  539.  
  540.    if function unsuccessful
  541.    Carry flag= set
  542.    AX     = error code
  543.            8011H  descriptor unavailable
  544.            8022H  invalid selector
  545.  
  546. Notes:
  547.  
  548. o  The selector supplied to the function may be either a
  549.    data selector or an executable selector. Note that the
  550.    published 0.9 specification was in error to say that the
  551.    function generates an error on a data descriptor.
  552. o  The descriptor alias returned by this function will not
  553.    track changes to the original descriptor.  In other
  554.    words, if an alias is created with this function, and the
  555.    base or limit of the original segment is then changed,
  556.    the two descriptors will no longer map the same memory.
  557. o  Refer to the rules for descriptor usage in Appendix D.
  558. Int 31H Function 000BH [0.9]
  559.  
  560. Get Descriptor
  561.  
  562. Copies the local descriptor table (LDT) entry for the
  563. specified selector into an 8-byte buffer.
  564.  
  565. Call With:
  566.  
  567.    AX     = 000BH
  568.    BX     = selector
  569.    ES:(E)DI= selector:offset of 8-byte buffer
  570.  
  571. Returns:
  572.  
  573.    if function successful
  574.    Carry flag= clear
  575.  
  576.    and buffer pointed to by ES:(E)DI contains descriptor
  577.    if function unsuccessful
  578.    Carry flag= set
  579.    AX     = error code
  580.            8022H   invalid selector
  581.  
  582. Notes:
  583.  
  584. o  32-bit programs must use ES:EDI to point to the buffer. 
  585.    16-bit programs should use ES:DI.
  586. o  Refer to the rules for descriptor usage in Appendix D.
  587. Int 31H Function 000CH [0.9]
  588.  
  589. Set Descriptor
  590.  
  591. Copies the contents of an 8-byte buffer into the LDT
  592. descriptor for the specified selector.
  593.  
  594. Call With:
  595.  
  596.    AX     = 000CH
  597.    BX     = selector
  598.    ES:(E)DI= selector:offset of 8-byte buffer containing
  599.            descriptor
  600.  
  601. Returns:
  602.  
  603.    if function successful
  604.    Carry flag= clear
  605.  
  606.    if function unsuccessful
  607.    Carry flag= set
  608.    AX     = error code
  609.            8021H   invalid value (access rights/type byte
  610.                    invalid)
  611.            8022H   invalid selector
  612.            8025H   invalid linear address (descriptor
  613.                    references a linear address range outside
  614.                    that allowed for DPMI clients)
  615.  
  616. Notes:
  617.  
  618. o  32-bit programs must use ES:EDI to point to the buffer. 
  619.    16-bit programs should use ES:DI.
  620. o  The descriptor's access rights/type byte (byte 5) follows
  621.    the same format and restrictions as the access
  622.    rights/type parameter (in CL) for the Set Descriptor
  623.    Access R
  624. ights function (Int 31H Function 0009H).  On 80386 (or later)
  625.    machines, the descriptor's extended access rights/type
  626.    byte (byte 6) follows the same format and restrictions as
  627.    the extended access rights/type parameter (in CH) for the
  628.    same function, except the low-order 4 bits (marked
  629.    "reserved") are used to set the upper 4 bits of the
  630.    descriptor's limit.
  631. o  If the descriptor's present bit is not set, then the only
  632.    error checking is that the client's CPL must be equal to
  633.    the descriptor's DPL field and the "must be 1" bit in the
  634.    descriptor's byte 5 must be set.
  635. o  A DPMI 1.0 host will reload any segment register which
  636.    contains a selector specified in register BX.  It is
  637.    suggested that DPMI 0.9 hosts also implement this.
  638.  
  639. o  Refer to the rules for descriptor usage in Appendix D.
  640.  
  641. Int 31H Function 000DH [0.9]
  642.  
  643. Allocate Specific LDT Descriptor
  644.  
  645. Allocates a specific LDT descriptor.
  646.  
  647. Call With:
  648.  
  649.    AX     = 000DH
  650.    BX     = selector
  651.  
  652. Returns:
  653.  
  654.    if function successful
  655.    Carry flag= clear
  656.  
  657.    and descriptor has been allocated
  658.    if function unsuccessful
  659.    Carry flag= set
  660.    AX     = error code
  661.            8011H   descriptor unavailable (descriptor is in
  662.                    use)
  663.            8022H   invalid selector (references GDT or
  664.                    beyond the LDT limit)
  665.  
  666. Notes:
  667.  
  668. o  The first 10H (16) descriptors (selector values 04H-7CH)
  669.    are reserved for this function and must not be used by
  670.    the DPMI host.
  671. o  Under DPMI 0.9 hosts, if another application has already
  672.    been loaded, some of descriptors reserved for allocation
  673.    by this function may be already in use and unavailable. 
  674.    Under DPMI 1.0 hosts, each client has its own LDT and
  675.    thus will have the full 16 descriptors available for use
  676.    with this function.
  677. o  Resident service providers (protected-mode TSRs) should
  678.    not use this function.
  679. o  Refer to the rules for descriptor usage in Appendix D.
  680. Int 31H Function 000EH [1.0]
  681.  
  682. Get Multiple Descriptors
  683.  
  684. Copies one or more local descriptor table (LDT) entries into
  685. a client buffer.
  686.  
  687. Call With:
  688.  
  689.    AX     = 000EH
  690.    CX     = number of descriptors to copy
  691.    ES:(E)DI= selector:offset of a buffer in the following
  692.            format:
  693.  
  694.            Offset   Length   Contents
  695.            00H      2        Selector #1 (set by client)
  696.            02H      8        Descriptor #1 (returned by
  697.            host)
  698.            0AH      2        Selector #2 (set by client)
  699.            0CH      8        Descriptor #2 (returned by
  700.            host)
  701.            .        .        .
  702.            .        .        .
  703.            .        .        .
  704.  
  705. Returns:
  706.  
  707.    if function successful
  708.    Carry flag= clear
  709.  
  710.    and buffer contains copies of the descriptors for the
  711.    specified selectors
  712.  
  713.    if function unsuccessful
  714.    Carry flag= set
  715.    AX     = error code
  716.            8022H   invalid selector
  717.    CX     = number of descriptors successfully copied
  718.  
  719. Notes:
  720.  
  721. o  If an error occurs because of an invalid selector or
  722.    descriptor, the function returns the number of
  723.    descriptors which were successfully copied in CX.  All of
  724.    the descriptors which were copied prior to the one that
  725.    failed are valid.
  726. o  32-bit programs must use ES:EDI to point to the buffer. 
  727.    16-bit programs should use ES:DI.
  728. o  Refer to the rules for descriptor usage in Appendix D.
  729. Int 31H Function 000FH [1.0]
  730.  
  731. Set Multiple Descriptors
  732.  
  733. Copies one or more descriptors from a client buffer into the
  734. local descriptor table (LDT).
  735.  
  736. Call With:
  737.  
  738.    AX     = 000FH
  739.    CX     = number of descriptors to copy
  740.    ES:(E)DI= selector:offset of a buffer in the following
  741.            format:
  742.  
  743.            Offset   Length   Contents
  744.            00H      2        Selector #1
  745.            02H      8        Descriptor #1
  746.            0AH      2        Selector #2
  747.            0CH      8        Descriptor #2
  748.            .        .        .
  749.            .        .        .
  750.            .        .        .
  751.  
  752. Returns:
  753.  
  754.    if function successful
  755.    Carry flag= clear
  756.  
  757.    if function unsuccessful
  758.    Carry flag= set
  759.    AX     = error code
  760.            8021H   invalid value (access rights/type bytes
  761.                    invalid)
  762.            8022H   invalid selector 8025H    invalid linear
  763.                    address (descriptor references a linear
  764.                    address range outside that allowed for
  765.                    DPMI clients)
  766.    CX     = number of descriptors successfully copied
  767.  
  768. Notes:
  769.  
  770. o  If an error occurs because of an invalid selector or
  771.    descriptor, the function returns the number of
  772.    descriptors which were successfully copied in CX.  All of
  773.    the descriptors which were copied prior to the one that
  774.    failed are valid.  All descriptors from the invalid entry
  775.    to the end of the table are not updated.
  776. o  32-bit programs must use ES:EDI to point to the buffer. 
  777.    16-bit programs should use ES:DI.
  778. o  A descriptor's access rights/type byte (byte 5) follows
  779.    the same format and restrictions as the access
  780.    rights/type parameter (in CL) for the Set Descriptor
  781.    Access Rights function (Int 31H Function 0009H).  On
  782.    80386 (or later) machines, the descriptor's extended
  783.    access rights/type byte (byte 6) follows the same format
  784.    and restrictions as the extended access rights/type
  785.    parameter (in CH) for the same function, except the
  786.    low-order 4 bits (marked "reserved") are used to set the
  787.    upper 4 bits of the descriptor's limit.
  788. o  If the descriptor's present bit is not set, then the only
  789.    error checking is that the client's CPL must be equal to
  790.    the descriptor's DPL field and the "must be 1" bit in the
  791.    descriptor's byte 5 must be set.
  792. o  A DPMI 1.0 host will reload any segment register which
  793.    contains a selector specified in the data structure
  794.    supplied to this function.  It is suggested that DPMI 0.9
  795.    hosts also implement this.
  796. o  Refer to the rules for descriptor usage in Appendix D.
  797. Int 31H Function 0100H [0.9]
  798.  
  799. Allocate DOS Memory Block
  800.  
  801. Allocates a block of memory from the DOS memory pool, i.e.
  802. memory below the 1 MB boundary that is controlled by DOS. 
  803. Such memory blocks are typically used to exchange data with
  804. real mode programs, TSRs, or device drivers.  The function
  805. returns both the real mode segment base address of the block
  806. and one or more descriptors that can be used by protected
  807. mode applications to access the block.
  808.  
  809. Call With:
  810.  
  811.    AX     = 0100H
  812.    BX     = number of (16-byte) paragraphs desired
  813.  
  814. Returns:
  815.  
  816.    if function successful
  817.    Carry flag= clear
  818.    AX     = real mode segment base address of allocated
  819.            block
  820.    DX     = selector for allocated block
  821.  
  822.    if function unsuccessful
  823.    Carry flag= set
  824.    AX     = error code
  825.            0007H   memory control blocks damaged (also
  826.                    returned by DPMI 0.9 hosts)
  827.            0008H   insufficient memory (also returned by
  828.                    DPMI 0.9 hosts).
  829.            8011H   descriptor unavailable
  830.    BX     = size of largest available block in paragraphs
  831.  
  832. Notes:
  833.  
  834. o  If the size of the block requested is greater than 64 KB
  835.    (BX > 1000H) and the client is a 16-bit program,
  836.    contiguous descriptors are allocated and the base
  837.    selector is returned.  The consecutive selectors for the
  838.    memory block can be calculated using the value returned
  839.    by the Get Selector Increment Value function (Int 31H
  840.    Function 0003H).  Each descriptor has a limit of 64 KB,
  841.    except for the last which has a limit of blocksize MOD 64
  842.    KB.
  843. o  If the DPMI host is 32-bit, the client is 16-bit, and
  844.    more than one descriptor is allocated, the limit of the
  845.    first descriptor will be set to the size of the entire
  846.    block.  Subsequent descriptors have limits as described
  847.    in the previous Note. 16-bit DPMI hosts will always set
  848.    the limit of the first descriptor to 64 KB even when
  849.    running on an 80386 (or later) machine.
  850. o  When the client is 32-bit, this function always allocates
  851.    only one descriptor.
  852. o  Client programs should never modify or free any
  853.    descriptors allocated by this function.  The Free DOS
  854.    Memory Block function (Int 31H Function 0101H) will
  855.    deallocate the descriptors automatically.
  856. o  The DOS allocation function (Int 21H Function 48H) is
  857.    used.
  858. o  Refer to the rules for descriptor usage in Appendix D.
  859. Int 31H Function 0101H [0.9]
  860.  
  861. Free DOS Memory Block
  862.  
  863. Frees a memory block that was previously allocated with the
  864. Allocate DOS Memory Block function (Int 31H Function 0100H).
  865.  
  866. Call With:
  867.  
  868.    AX     = 0101H
  869.    DX     = selector of block to be freed
  870.  
  871. Returns:
  872.  
  873.    if function successful
  874.    Carry flag= clear
  875.  
  876.    if function unsuccessful
  877.    Carry flag= set
  878.    AX     = error code
  879.            0007H   memory control blocks damaged (also
  880.                    returned by DPMI 0.9 hosts).
  881.            0009H   incorrect memory segment specified (also
  882.                    returned by DPMI 0.9 hosts).
  883.            8022H   invalid selector
  884.  
  885. Notes:
  886.  
  887. o  All descriptors allocated for the memory block are
  888.    automatically freed by this function, and are no longer
  889.    valid after this function returns.
  890. o  Under DPMI 1.0 hosts, any segment registers which contain
  891.    a selector being freed are zeroed by this function.
  892. o  Refer to the rules for descriptor usage in Appendix D.
  893. Int 31H Function 0102H [0.9]
  894.  
  895. Resize DOS Memory Block
  896.  
  897. Changes the size of a memory block that was previously al
  898. located with the Allocate DOS Memory Block function (Int 31H
  899. Function 0100H).
  900.  
  901. Call With:
  902.  
  903.    AX     = 0102H
  904.    BX     = new block size in (16-byte) paragraphs
  905.    DX     = selector of block to modify
  906.  
  907. Returns:
  908.  
  909.    if function successful
  910.    Carry flag= clear
  911.  
  912.    if function unsuccessful
  913.    Carry flag= set
  914.    AX     = error code
  915.            0007H   memory control blocks damaged (also
  916.                    returned by DPMI 0.9 hosts).
  917.            0008H   insufficient memory (also returned by
  918.                    DPMI 0.9 hosts).
  919.            0009H   incorrect memory segment specified (also
  920.                    returned by DPMI 0.9 hosts).
  921.            8011H   descriptor unavailable
  922.            8022H   invalid selector
  923.    BX     = maximum possible block size (paragraphs)
  924.  
  925. Notes:
  926.  
  927. o  Requests to increase the size of an existing DOS memory
  928.    block may fail due to subsequent DOS memory block
  929.    allocations causing fragmentation of DOS memory, or
  930.    insufficient remaining DOS memory.  In addition, the
  931.    function will fail if the block is growing past a 64 KB
  932.    boundary and the next descriptor in the LDT is not
  933.    available.
  934. o  A request to decrease the size of a DOS memory block may
  935.    cause some descriptors that were previously allocated to
  936.    the block to be freed and the limit of the new last
  937.    descriptor for the block to be changed.
  938. o  Under a DPMI 1.0 host, any segment registers which
  939.    contain a selector being modified are reloaded by this
  940.    function and any segment registers which contain a
  941.    selector being freed are zeroed by this function.
  942. o  Client programs should never modify or free any
  943.    descriptors allocated by this function.  The Free DOS
  944.    Memory Block function (Int 31H Function 0101H) will
  945.    deallocate the descriptors automatically.
  946. o  Refer to the rules for descriptor usage in Appendix D.
  947.  
  948. Int 31H Function 0200H [0.9]
  949.  
  950. Get Real Mode Interrupt Vector
  951.  
  952. Returns the contents of the current virtual machine's real
  953. mode interrupt vector for the specified interrupt.
  954.  
  955. Call With:
  956.  
  957.    AX     = 0200H
  958.    BL     = interrupt number
  959.  
  960. Returns:
  961.  
  962.    Carry flag= clear (this function always succeeds)
  963.    CX:DX  = segment:offset of real mode interrupt handler
  964.  
  965. Notes:
  966.  
  967. o  The value returned in CX is a real mode segment address,
  968.    not a selector.  Attempts to place this value into a
  969.    segment register in protected mode may cause a general
  970.    protection (GP) fault.
  971. o  All 100H (256) real mode interrupt vectors must be made
  972.    available through this function by the DPMI host.
  973. Int 31H Function 0201H [0.9]
  974.  
  975. Set Real Mode Interrupt Vector
  976.  
  977. Sets the current virtual machine's real mode interrupt
  978. vector for the specified interrupt.
  979.  
  980. Call With:
  981.  
  982.    AX     = 0201H
  983.    BL     = interrupt number
  984.    CX:DX  = segment:offset of real mode interrupt handler
  985.  
  986. Returns:
  987.  
  988.    Carry flag= clear (this function always succeeds)
  989.  
  990. Notes:
  991.  
  992. o  The address passed in CX must be a real mode segment
  993.    address, not a selector.  Consequently, the interrupt
  994.    handler must either reside in DOS memory (i.e. below the
  995.    1 MB boundary) or the client must allocate a real mode
  996.    callback address.  See Int 31H Functions 0100H and 0303H.
  997. o  If the interrupt being hooked is a hardware interrupt,
  998.    the memory  that the interrupt handler uses must be
  999.    locked.
  1000.  
  1001. Int 31H Function 0202H [0.9]
  1002.  
  1003. Get Processor Exception Handler Vector
  1004.  
  1005. Returns the address of the current client's protected mode
  1006. exception handler for the specified exception number.  This
  1007. function should be avoided by DPMI 1.0 clients (see Notes).
  1008.  
  1009. Call With:
  1010.  
  1011.    AX     = 0202H
  1012.    BL     = exception number (00H-1FH)
  1013.  
  1014. Returns:
  1015.  
  1016.    if function successful
  1017.    Carry flag= clear
  1018.    CX:(E)DX= selector:offset of exception handler
  1019.  
  1020.    if function unsuccessful
  1021.    Carry flag= set
  1022.    AX     = error code
  1023.            8021H   invalid value (BL not in range 0-1FH)
  1024.  
  1025. Notes:
  1026.  
  1027. o  The value returned in CX is a valid protected mode
  1028.    selector, not a real mode segment address.
  1029. o  32-bit clients will be returned a 32-bit offset in the
  1030.    EDX register.
  1031. o  Clients which run under DPMI 1.0 should use Int 31H
  1032.    Functions 0210H and 0211H to obtain the addresses of
  1033.    exception handlers.  This function is supported by DPMI
  1034.    1.0 hosts solely for compatibility with DPMI 0.9.
  1035. Int 31H Function 0203H [0.9]
  1036.  
  1037. Set Processor Exception Handler Vector
  1038.  
  1039. Sets the address of a handler for a CPU exception or fault,
  1040. allowing a protected mode application to intercept processor
  1041. exceptions (such as segment not present faults) that are not
  1042. handled by the DPMI host and would otherwise generate a
  1043. fatal error.  This function should be avoided by DPMI 1.0
  1044. clients (see Notes).
  1045.  
  1046. Call With:
  1047.  
  1048.    AX     = 0203H
  1049.    BL     = exception/fault number (00H-1FH)
  1050.    CX:(E)DX= selector:offset of exception handler
  1051.  
  1052. Returns:
  1053.  
  1054.    if function successful
  1055.    Carry flag= clear
  1056.  
  1057.    if function unsuccessful
  1058.    Carry flag= set
  1059.    AX     = error code
  1060.            8021H   invalid value (BL not in range 0-1FH)
  1061.            8022H   invalid selector
  1062.  
  1063. Notes:
  1064.  
  1065. o  The value passed in CX should  be a valid protected mode
  1066.    code (executable) selector, not a real mode segment
  1067.    address.
  1068. o  32-bit clients must supply a 32-bit offset in the EDX
  1069.    register.  If the client's handler chains to the next
  1070.    exception handler, it must do so using a 32-bit interrupt
  1071.    stack frame.
  1072. o  Every exception is first examined by the DPMI host.  If
  1073.    the host does not handle the exception, it reflects the
  1074.    exception to the first handler in the protected mode
  1075.    exception handler chain.  See page 30 for a complete
  1076.    discussion of the environment and responsibilities of
  1077.    protected mode exception handlers installed with this
  1078.    function.
  1079. o  Clients which run under DPMI 1.0 should use Int 31H
  1080.    Functions 0212H and 0213H to set the addresses of
  1081.    exception handlers.  This function is supported by DPMI
  1082.    1.0 hosts solely for compatibility with DPMI 0.9.
  1083. o  Refer to the rules for descriptor usage in Appendix D.
  1084. Int 31H Function 0204H [0.9]
  1085.  
  1086. Get Protected Mode Interrupt Vector
  1087.  
  1088. Returns the address of the current protected mode interrupt
  1089. handler for the specified interrupt.
  1090.  
  1091. Call With:
  1092.  
  1093.    AX     = 0204H
  1094.    BL     = interrupt number
  1095.  
  1096. Returns:
  1097.  
  1098.    Carry flag= clear (this function always succeeds)
  1099.    CX:(E)DX= selector:offset of exception handler
  1100.  
  1101. Notes:
  1102.  
  1103. o  The value returned in CX is a valid protected mode
  1104.    selector, not a real mode segment address.
  1105. o  32-bit clients will be returned a 32-bit offset in the
  1106.    EDX register.
  1107. o  DPMI hosts must make all 100H (256) interrupt vectors
  1108.    available through this function.
  1109. Int 31H Function 0205H [0.9]
  1110.  
  1111. Set Protected Mode Interrupt Vector
  1112.  
  1113. Sets the address of protected mode handler for the specified
  1114. interrupt into the interrupt vector.
  1115.  
  1116. Call With:
  1117.  
  1118.    AX     = 0205H
  1119.    BL     = interrupt number
  1120.    CX:(E)DX= selector:offset of exception handler
  1121.  
  1122. Returns:
  1123.  
  1124.    if function successful
  1125.    Carry flag= clear
  1126.  
  1127.    if function unsuccessful
  1128.    Carry flag= set
  1129.    AX     = error code
  1130.            8022H   invalid selector
  1131.  
  1132. Notes:
  1133.  
  1134. o  The value passed in CX  should be a valid protected mode
  1135.    code selector, not a real mode segment address.
  1136. o  32-bit clients must supply a 32-bit offset in the EDX
  1137.    register.  If the client's handler chains to the next
  1138.    exception handler it must do so using a 32-bit interrupt
  1139.    stack frame.
  1140. o  DPMI hosts must support all 100H (256 decimal) interrupt
  1141.    vectors with this function.
  1142. o  Hardware interrupts are sent to the primary client of the
  1143.    virtual machine while software interrupts are sent to the
  1144.    current client. (See Appendix A: Glossary for definitions
  1145.    of primary and current client.)
  1146. o  Refer to the rules for descriptor usage in Appendix D.
  1147. Int 31H Function 0210H [1.0]
  1148.  
  1149. Get Extended Processor Exception Handler Vector
  1150. (Protected Mode)
  1151.  
  1152. Returns the address of the client's protected mode handler
  1153. for the specified protected mode exception.
  1154.  
  1155. Call With:
  1156.  
  1157.    AX     = 0210H
  1158.    BL     = exception number (00H-1FH)
  1159.  
  1160. Returns:
  1161.  
  1162.    if function successful
  1163.    Carry flag= clear
  1164.    CX:(E)DX= selector:offset of exception handler
  1165.  
  1166.    if function unsuccessful
  1167.    Carry flag= set
  1168.    AX     = error code
  1169.            8021H   invalid value (BL not in range 00H-1FH)
  1170.  
  1171. Notes:
  1172.  
  1173. o  DPMI 1.0 clients should use this function in preference
  1174.    to Int 31H Function 0202H.
  1175. o  The protected mode exceptions are sent to the protected
  1176.    mode handler of the current client. (See Appendix A:
  1177.    Glossary for definition of primary client.)
  1178.  
  1179. Int 31H Function 0211H [1.0]
  1180.  
  1181. Get Extended Processor Exception Handler Vector
  1182. (Real Mode)
  1183.  
  1184. Returns the address of the client's protected mode handler
  1185. for the specified real mode exception.
  1186.  
  1187. Call With:
  1188.  
  1189.    AX     = 0211H
  1190.    BL     = exception number (00H-1FH)
  1191.  
  1192. Returns:
  1193.  
  1194.    if function successful
  1195.    Carry flag= clear
  1196.    CX:(E)DX= selector
  1197.    :offset of exception handler
  1198.  
  1199.    if function unsuccessful
  1200.    Carry flag= set
  1201.    AX     = error code
  1202.            8021H   invalid value (BL not in range 00H-1FH)
  1203.  
  1204. Notes:
  1205.  
  1206. o  CX:(E)DX does not specify a real-mode segment:offset. 
  1207.    The reason is that this function allows a client to get
  1208.    the address of the exception handler which will receive
  1209.    control in protected mode when the specified exception
  1210.    occurs in real mode (i.e. the host will provide an 
  1211.    implied mode switch for the purposes of servicing the
  1212.    exception, then return to real mode after  the handler
  1213.    exits)..
  1214. o  Real mode exceptions are sent to the primary client of
  1215.    the virtual machine.
  1216.  
  1217.  
  1218.  
  1219. Int 31H Function 0212H [1.0]
  1220.  
  1221. Set Extended Processor Exception Handler Vector
  1222. (Protected Mode)
  1223.  
  1224. Sets the address of the client's protected mode handler for
  1225. the specified protected mode exception.
  1226.  
  1227. Call With:
  1228.  
  1229.    AX     = 0212H
  1230.    BL     = exception/fault number (00H-1FH)
  1231.    CX:(E)DX= selector:offset of exception handler
  1232.  
  1233. Returns:
  1234.  
  1235.    if function successful
  1236.    Carry flag= clear
  1237.  
  1238.    if function unsuccessful
  1239.    Carry flag= set
  1240.    AX     = error code
  1241.            8021H   invalid value (BL not in range 00H-1FH)
  1242.            8022H   invalid selector
  1243.  
  1244. Notes:
  1245.  
  1246. o  DPMI 1.0 clients should use this function in preference
  1247.    to Int 31H Function 0203H.
  1248. o  The protected mode exceptions are sent to the protected
  1249.    mode handler of the current client.
  1250. o  Refer to the rules for descriptor usage in Appendix D.
  1251.  
  1252.  
  1253. Int 31H Function 0213H [1.0]
  1254.  
  1255. Set Extended Processor Exception Handler Vector
  1256. (Real Mode)
  1257.  
  1258. Sets the address of the client's protected mode handler for
  1259. the specified real mode exception.
  1260.  
  1261. Call With:
  1262.  
  1263.    AX     = 0213H
  1264.    BL     = exception/fault number (00H-1FH)
  1265.    CX:(E)DX= selector:offset of exception handler
  1266.  
  1267. Returns:
  1268.  
  1269.    if function successful
  1270.    Carry flag= clear
  1271.  
  1272.    if function unsuccessful
  1273.    Carry flag= set
  1274.    AX     = error code
  1275.            8021H   invalid value (BL not in range 00H-1FH)
  1276.            8022H   invalid selector
  1277.  
  1278. Notes:
  1279.  
  1280. o  CX:(E)DX does not specify a real-mode segment:offset. 
  1281.    The reason is that this function allows a client to set
  1282.    the address of an exception handler which will receive
  1283.    control in protected mode when the specified exception
  1284.    occurs in real mode (i.e. the host will provide an
  1285.    implied mode switch for the purposes of servicing the
  1286.    exception, then return to real mode after  the handler
  1287.    exits). 
  1288. o  Real mode exceptions are sent to the primary client of
  1289.    the virtual machine. (See Appendix A: Glossary for
  1290.    definition of primary client.)
  1291. o  Refer to the rules for descriptor usage in Appendix D.
  1292. Int 31H Function 0300H [0.9]
  1293.  
  1294. Simulate Real Mode Interrupt
  1295.  
  1296. Simulates an interrupt in real mode.  The function transfers
  1297. control to the address specified by the real mode interrupt
  1298. vector.  The real mode handler must return by executing an
  1299. IRET.
  1300.  
  1301. Call With:
  1302.  
  1303.    AX     = 0300H
  1304.    BL     = interrupt number
  1305.    BH     = flags
  1306.            Bit    Significance
  1307.            0      reserved for historical reason, must be
  1308.            zero
  1309.            1-7    reserved, must be zero
  1310.    CX     = number of words to copy from protected mode to
  1311.            real mode stack
  1312.    ES:(E)DI= selector:offset of real mode register data
  1313.            structure in the following format:
  1314.  
  1315.            Offset   Length  Contents
  1316.            00H      4       DI or EDI
  1317.            04H      4       SI or ESI
  1318.            08H      4       BP or EBP
  1319.            0CH      4       reserved, should be zero
  1320.            10H      4       BX or EBX
  1321.            14H      4       DX or EDX
  1322.            18H      4       CX or ECX
  1323.            1CH      4       AX or EAX
  1324.            20H      2       CPU status flags
  1325.            22H      2       ES
  1326.            24H      2       DS
  1327.            26H      2       FS
  1328.            28H      2       GS
  1329.            2AH      2       IP (reserved, ignored)
  1330.            2CH      2       CS (reserved, ignored)
  1331.            2EH      2       SP
  1332.            30H      2       SS
  1333.  
  1334. Returns:
  1335.  
  1336.    if function successful
  1337.    Carry flag= clear
  1338.    ES:(E)DI= selector:offset of modified real mode register
  1339.            data structure
  1340.  
  1341.    if function unsuccessful
  1342.    Carry flag= set
  1343.    AX     = error code
  1344.            8012H   linear memory unavailable (stack)
  1345.            8013H   physical memory unavailable (stack)
  1346.            8014H   backing store unavailable (stack)
  1347.            8021H   invalid value (CX too large)
  1348.  
  1349.  
  1350. Notes:
  1351.  
  1352. o  32-bit programs must use ES:EDI to point to the real mode
  1353.    register data structure.  16-bit programs should use
  1354.    ES:DI.
  1355. o  The CS:IP in the real mode register data structure is
  1356.    ignored by this function.  The appropriate interrupt
  1357.    handler will be called based on the value passed in BL.
  1358. o  If the SS:SP fields in the real mode register data
  1359.    structure are zero, a real mode stack will be provided by
  1360.    the DPMI host.  Otherwise, the real mode SS:SP will be
  1361.    set to the specified values before the interrupt handler
  1362.    is called.
  1363. o  The flags specified in the real mode register data
  1364.    structure will be pushed on the real mode stack's IRET
  1365.    frame.  The interrupt handler will be called with the
  1366.    interrupt and trace flags clear.
  1367. o  Values placed in the segment register positions of the
  1368.    data structure must be valid for real mode; i.e. the
  1369.    values must be paragraph addresses and not selectors.
  1370. o  All general register fields in the data structure are
  1371.    DWORDs so that 32-bit registers can be passed to real
  1372.    mode.  Note, however, that 16-bit hosts are not required
  1373.    to pass the high word of 32-bit general registers or the
  1374.    FS and GS segment registers to real mode even when
  1375.    running on an 80386 or later CPU.
  1376. o  The target real mode handler must return with the stack
  1377.    in the same state as when it was called.  This means that
  1378.    the real mode code may switch stacks while it is running,
  1379.    but must return on the same stack that it was called on
  1380.    and  must return with an IRET.
  1381. o  When this function returns, the real mode register data
  1382.    structure will contain the values that were returned by
  1383.    the real mode interrupt handler.
  1384. o  It is the caller's responsibility to remove any
  1385.    parameters that were pushed on the protected mode stack.
  1386. Int 31H Function 0301H [0.9]
  1387.  
  1388. Call Real Mode Procedure With Far Return Frame
  1389.  
  1390. Simulates a FAR CALL to a real mode procedure.  The called
  1391. procedure must return by executing a RETF (far return)
  1392. instruction.
  1393.  
  1394. Call With:
  1395.  
  1396.    AX     = 0301H
  1397.    BH     = flags
  1398.            Bit    Significance
  1399.            0      reserved for historical reason, must be
  1400.            zero
  1401.            1-7    reserved, must be zero
  1402.    CX     = number of words to copy from protected mode to
  1403.            real mode stack
  1404.    ES:(E)DI= selector:offset of real mode register data
  1405.            structure in the following format:
  1406.  
  1407.            Offset   Length  Contents
  1408.            00H      4       DI or EDI
  1409.            04H      4       SI or ESI
  1410.            08H      4       BP or EBP
  1411.            0CH      4       reserved, ignored
  1412.            10H      4       BX or EBX
  1413.            14H      4       DX or EDX
  1414.            18H      4       CX or ECX
  1415.            1CH      4       AX or EAX
  1416.            20H      2       CPU status flags
  1417.            22H      2       ES
  1418.            24H      2       DS
  1419.            26H      2       FS
  1420.            28H      2       GS
  1421.            2AH      2       IP
  1422.            2CH      2       CS
  1423.            2EH      2       SP
  1424.            30H      2       SS
  1425.  
  1426. Returns:
  1427.  
  1428.    if function successful
  1429.    Carry flag= clear
  1430.    ES:(E)DI= selector:offset of modified real mode register
  1431.            data structure
  1432.  
  1433.    if function unsuccessful
  1434.    Carry flag= set
  1435.    AX     = error code
  1436.            8012H   linear memory unavailable (stack)
  1437.            8013H   physical memory unavailable (stack)
  1438.            8014H   backing store unavailable (stack)
  1439.            8021H   invalid value (CX too large)
  1440.  
  1441.  
  1442.  
  1443.  
  1444. Notes:
  1445.  
  1446. o  32-bit programs must use ES:EDI to point to the real mode
  1447.    register data structure.  16-bit programs should use
  1448.    ES:DI.
  1449. o  The CS:IP in the real mode register data structure
  1450.    specifies the address of the real mode procedure to call.
  1451. o  If the SS:SP fields in the real mode register data
  1452.    structure are zero, a real mode stack will be provided by
  1453.    the DPMI host.  Otherwise, the real mode SS:SP will be
  1454.    set to the specified values before the interrupt handler
  1455.    is called.
  1456. o  Values placed in the segment register positions of the
  1457.    data structure must be valid for real mode; i.e. the
  1458.    values must be paragraph addresses and not selectors.
  1459. o  All general register fields in the data structure are
  1460.    DWORDs so that 32-bit registers can be passed to real
  1461.    mode.  Note, however, that 16-bit hosts are not required
  1462.    to pass the high word of 32-bit general registers or the
  1463.    FS and GS segment registers to real mode even when
  1464.    running on an 80386 or later CPU.
  1465. o  The target real mode procedure must return with the stack
  1466.    in the same state as when it was called.  This means that
  1467.    the real mode code may switch stacks while it is running,
  1468.    but must return on the same stack that it was called on
  1469.    and must exit with a RETF (far return) and should not
  1470.    clear the stack of any other parameters that were passed
  1471.    to it on the stack.
  1472. o  When this function returns, the real mode register data
  1473.    structure will contain the values that were returned by
  1474.    the real mode procedure.
  1475. o  It is the caller's responsibility to remove any
  1476.    parameters that were pushed on the protected mode stack.
  1477. Int 31H Function 0302H [0.9]
  1478.  
  1479. Call Real Mode Procedure With IRET Frame
  1480.  
  1481. Simulates a FAR CALL w
  1482. ith flags pushed on the stack to a real mode procedure.  The
  1483. real mode routine must return by executing an IRET
  1484. instruction.
  1485.  
  1486. Call With:
  1487.  
  1488.    AX     = 0302H
  1489.    BH     = flags
  1490.            Bit    Significance
  1491.            0      reserved for historical reason, must be
  1492.            zero
  1493.            1-7    reserved, must be zero
  1494.    CX     = number of words to copy from protected mode to
  1495.            real mode stack
  1496.    ES:(E)DI= selector:offset of real mode register data
  1497.            structure in the following format:
  1498.  
  1499.            Offset   Length  Contents
  1500.            00H      4       DI or EDI
  1501.            04H      4       SI or ESI
  1502.            08H      4       BP or EBP
  1503.            0CH      4       reserved, ignored
  1504.            10H      4       BX or EBX
  1505.            14H      4       DX or EDX
  1506.            18H      4       CX or ECX
  1507.            1CH      4       AX or EAX
  1508.            20H      2       CPU status flags
  1509.            22H      2       ES
  1510.            24H      2       DS
  1511.            26H      2       FS
  1512.            28H      2       GS
  1513.            2AH      2       IP
  1514.            2CH      2       CS
  1515.            2EH      2       SP
  1516.            30H      2       SS
  1517.  
  1518. Returns:
  1519.  
  1520.    if function successful
  1521.    Carry flag= clear
  1522.    ES:(E)DI= selector:offset of modified real mode register
  1523.            data structure
  1524.  
  1525.    if function unsuccessful
  1526.    Carry flag= set
  1527.    AX     = error code
  1528.            8012H   linear memory unavailable (stack)
  1529.            8013H   physical memory unavailable (stack)
  1530.            8014H   backing store unavailable (stack)
  1531.            8021H   invalid value (CX too large)
  1532.  
  1533.  
  1534.  
  1535.  
  1536. Notes:
  1537.  
  1538. o  32-bit programs must use ES:EDI to point to the real mode
  1539.    register data structure.  16-bit programs should use
  1540.    ES:DI.
  1541. o  The CS:IP in the real mode register data structure
  1542.    specifies the address of the real mode procedure to call.
  1543. o  If the SS:SP fields in the real mode register data
  1544.    structure are zero, a real mode stack will be provided by
  1545.    the DPMI host.  Otherwise, the real mode SS:SP will be
  1546.    set to the specified values before the interrupt handler
  1547.    is called.
  1548. o  The flags specified in the real mode register data
  1549.    structure will be pushed on the real mode stack's IRET
  1550.    frame.  The procedure will be called with the interrupt
  1551.    and trace flags clear.
  1552. o  Values placed in the segment register positions of the
  1553.    data structure must be valid for real mode; i.e. the
  1554.    values must be paragraph addresses and not selectors.
  1555. o  All general register fields in the data structure are
  1556.    DWORDs so that 32-bit registers can be passed to real
  1557.    mode.  Note, however, that 16-bit hosts are not required
  1558.    to pass the high word of 32-bit general registers or the
  1559.    FS and GS segment registers to real mode even when
  1560.    running on an 80386 or later CPU.
  1561. o  The target real mode handler or procedure must return
  1562.    with the stack in the same state as when it was called. 
  1563.    This means that the real mode code may switch stacks
  1564.    while it is running, but must return on the same stack
  1565.    that it was called on and must return with an IRET or
  1566.    discard the flags from the stack with a RETF(2) .
  1567. o  When this function returns, the real mode register data
  1568.    structure will contain the values that were returned by
  1569.    the real mode procedure.
  1570. o  It is the caller's responsibility to remove any
  1571.    parameters that were pushed on the protected mode stack.
  1572. Int 31H Function 0303H [0.9]
  1573.  
  1574. Allocate Real Mode Callback Address
  1575.  
  1576. Returns a unique real mode segment:offset, known as a "real
  1577. mode callback,"  that will transfer control from real mode
  1578. to a protected mode procedure.  Callback addresses obtained
  1579. with this function can be passed by a protected mode program
  1580. to a real mode application, interrupt handler, device
  1581. driver, or TSR, so that the real mode program can call
  1582. procedures within the protected mode program or notify the
  1583. protected mode program of an event.
  1584.  
  1585. Call With:
  1586.  
  1587.    AX     = 0303H
  1588.    DS:(E)SI= selector:offset of protected mode procedure to
  1589.            call
  1590.    ES:(E)DI= selector:offset of 32H-byte buffer for real
  1591.            mode register data structure to be used when
  1592.            calling callback routine.
  1593.  
  1594. Returns:
  1595.  
  1596.    if function successful
  1597.    Carry flag= clear
  1598.    CX:DX  = segment:offset of real mode callback
  1599.  
  1600.    if function unsuccessful
  1601.    Carry flag= set
  1602.    AX     = error code
  1603.            8015H   callback unavailable
  1604.  
  1605. Notes:
  1606.  
  1607. o  DPMI hosts must provide a minimum of 16 callback
  1608.    addresses per client.
  1609. o  A descriptor may be allocated for each callback to hold
  1610.    the real mode SS descriptor. Real mode callbacks are a
  1611.    limited system resource.  A client should use the Free
  1612.    Real Mode Callback Address function (Int 31H Function
  1613.    0304H) to release a callback that it is no longer using.
  1614. o  For further information on writing real mode callback
  1615.    procedures, see page 34.
  1616. o  The contents of the real mode register data structure is
  1617.    not valid after the function call, but only at the time
  1618.    of the actual callback.
  1619.  
  1620. Int 31H Function 0304H [0.9]
  1621.  
  1622. Free Real Mode Callback Address
  1623.  
  1624. Releases a real mode callback address that was previously
  1625. allocated with the Allocate Real Mode Callback Address
  1626. function (Int 31H Function 0303H).
  1627.  
  1628. Call With:
  1629.  
  1630.    AX     = 0304H
  1631.    CX:DX  = real mode callback address to be freed
  1632.  
  1633. Returns:
  1634.  
  1635.    if function successful
  1636.    Carry flag= clear
  1637.  
  1638.    if function unsuccessful
  1639.    Carry flag= set
  1640.    AX     = error code
  1641.            8024H   invalid callback address
  1642.  
  1643. Notes:
  1644.  
  1645. o  Real mode callbacks are a limited system resource.  A
  1646.    client should release any callback that it is no longer
  1647.    using.
  1648. Int 31H Function 0305H [0.9]
  1649.  
  1650. Get State Save/Restore Addresses
  1651.  
  1652. Returns the addresses of two procedures used to save and
  1653. restore the state of the current task's registers in the
  1654. mode which is not currently executing. 
  1655.  
  1656. Call With:
  1657.  
  1658.    AX     = 0305H
  1659.  
  1660. Returns:
  1661.  
  1662.    Carry flag = clear (this function always succeeds)
  1663.    AX     = size of buffer in bytes required to save state
  1664.    BX:CX  = real mode address of routine used to
  1665.            save/restore state
  1666.    SI:(E)DI= protected mode address of routine used to
  1667.            save/restore state
  1668.  
  1669. Notes:
  1670.  
  1671. o  The real mode address returned by this function in BX:CX
  1672.    is called only in real mode to save/restore the state of
  1673.    the protected mode registers.  The protected mode address
  1674.    returned by this function in SI:(E)DI  is called only in
  1675.    protected mode to save/restore the state of the real mode
  1676.    registers; 16-bit programs should call the address in
  1677.    SI:DI, 32-bit programs should call the address in SI:EDI. 
  1678.    Registers for the current mode can be saved by simply
  1679.    pushing them on the stack.
  1680. o  Both of the state-save procedures are entered by a FAR
  1681.    CALL with the following parameters:
  1682.  
  1683. AL = 0 to save state
  1684.    = 1 to restore state
  1685. ES:(E)DI= (selector or segment):offset of state-save buffer
  1686.  
  1687. The state-save buffer must be at least as large as the value returned
  1688.    in AX by Int 31H Function 0305H.  The state save/restore
  1689.    procedures do not modify any registers.  For a further
  1690.    discussion of use of the state save/restore procedures,
  1691.    see page 25.
  1692. o  Some DPMI hosts will not require the state to be saved,
  1693.    indicating this by returning a buffer size of zero in AX. 
  1694.    In such cases, the addresses returned by this function
  1695.    can still be called, although they will simply return
  1696.    without performing any useful function.
  1697. o  Clients do not need to call the state save/restore
  1698.    procedures before using Int 31H Functions 0300H, 0301H,
  1699.    or 0302H.  The state save/restore procedures are provided
  1700.    specifically for clients that use the raw mode switch
  1701.    services.
  1702. o  A client can use the function to save its state in the
  1703.    destination mode before switching modes using the raw
  1704.    mode switch or issuing real-mode calls from a protected
  1705.    mode hardware interrupt handler. Refer to page 24 for the
  1706.    detailed information on stacks and mode switching.
  1707. Int 31H Function 0306H [0.9]
  1708.  
  1709. Get Raw Mode Switch Addresses
  1710.  
  1711. Returns addresses that can be called for low-level mode
  1712. switching.
  1713.  
  1714. Call With:
  1715.  
  1716.    AX     = 0306H
  1717.  
  1718. Returns:
  1719.  
  1720.    Carry flag = clear (this function always succeeds)
  1721.    BX:CX  = real-to-protected mode switch address
  1722.    SI:(E)DI= protected-to-real mode switch address
  1723.  
  1724. Notes:
  1725.  
  1726. o  The address returned in BX:CX must only be called in real
  1727.    mode to switch into protected mode.  The address returned
  1728.    in SI:(E)DI must only be called in protected mode to
  1729.    switch into real mode; 16-bit programs should call the
  1730.    address returned by this function in SI:DI, while 32-bit
  1731.    programs should call the address returned in SI:EDI.
  1732.  
  1733. o  The mode switch procedures are entered by a FAR JMP to
  1734.    the appropriate address with the following parameters:
  1735.  
  1736. AX = new DS
  1737. CX = new ES
  1738. DX = new SS
  1739. (E)BX= new (E)SP
  1740. SI = new CS
  1741. (E)DI= new (E)IP
  1742.  
  1743. The processor is placed into the desired mode, and the DS, ES, SS,
  1744.    (E)SP, CS, and (E)IP registers are updated with the
  1745.    specified values; in other words, execution of the client
  1746.    continues in the requested mode at the address provided
  1747.    in registers SI:(E)DI.  The values specified to be placed
  1748.    into th
  1749. e segment registers must be appropriate for the destination mode; if
  1750.    invalid selectors are supplied when switching into
  1751.    protected mode, an exception will occur.
  1752.  
  1753. The values in (E)AX, (E)BX, (E)CX, (E)DX, (E)SI, and (E)DI after the
  1754.    mode switch are undefined. (E)BP will be preserved across
  1755.    the mode switch call so it can be used as a pointer. On
  1756.    an 80386 or later CPU, the FS and GS segment registers
  1757.    will contain zero after the mode switch.
  1758.  
  1759. If interrupts are disabled when the mode switch procedure is invoked,
  1760.    they will not be re-enabled by the DPMI host (even
  1761.    temporarily).
  1762.  
  1763. o  It is up to the client to save and restore the state of
  1764.    the task when using this function to switch modes.  This
  1765.    usually requires using the state save/restore procedures
  1766.    whose addresses are returned by Int 31H Function 0305H
  1767.    (see page 94).
  1768.  
  1769. o  Clients may find it more convenient to use Int 31H
  1770.    Functions 0300H, 0301H, and 0302H for mode switching than
  1771.    this function.
  1772.  
  1773. Int 31H Function 0400H [0.9]
  1774.  
  1775. Get Version
  1776.  
  1777. Returns the version number of the DPMI Specification
  1778. implemented by the DPMI host.  Clients can use this
  1779. information to determine which function calls are supported
  1780. in the current environment.
  1781.  
  1782. Call With:
  1783.  
  1784.    AX     = 0400H
  1785.  
  1786. Returns:
  1787.  
  1788.    Carry flag= clear (this function always succeeds)
  1789.    AH     = DPMI major version as a  binary number
  1790.    AL     = DPMI minor version as a  binary number
  1791.    BX     = flags
  1792.            Bits   Significance
  1793.            0      0 = host is 16-bit DPMI implementation
  1794.                   1 = host is 32-bit (80386) DPMI
  1795.            implementation
  1796.            1      0 = CPU returned to Virtual 86 mode for
  1797.            reflected interrupts
  1798.                   1 = CPU returned to real mode for
  1799.            reflected interrupts
  1800.            2      0 = virtual memory not supported
  1801.                   1 = virtual memory supported
  1802.            3      reserved, for historical reasons
  1803.            4-15   reserved for later use
  1804.    CL     = processor type
  1805.            02H = 80286
  1806.            03H = 80386
  1807.            04H = 80486
  1808.            05H-FFH       reserved for future Intel
  1809.            processors
  1810.    DH     = current value of virtual master PIC base
  1811.            interrupt
  1812.    DL     = current value of virtual slave PIC base
  1813.            interrupt
  1814.  
  1815. Notes:
  1816.  
  1817. o  Under DPMI hosts, the major version number is returned in
  1818.    DH and the minor version number is returned in DL. There
  1819.    are two decimal digits for the minor version number with
  1820.    the least-significant digit representing the revision
  1821.    number of the minor version number. Under DPMI version
  1822.    0.9 hosts, DH is returned as 0, and DL is returned as
  1823.    decimal 90 (5AH). In hypothetical DPMI version 2.3, DH
  1824.    would be returned as 2 and DL would be returned as 30
  1825.    (1EH).
  1826.  
  1827.  
  1828. Int 31H Function 0401H [1.0]
  1829.  
  1830. Get DPMI Capabilities
  1831.  
  1832. Returns information about the capabilities of the DPMI host,
  1833. including its support or lack of support for optional
  1834. features in the DPMI Specification.  Clients can use this
  1835. information to optimize their use of system resources in the
  1836. current environment.
  1837.  
  1838. Call With:
  1839.  
  1840.    AX     = 0401H
  1841.    ES:(E)DI= selector:offset of 128-byte buffer
  1842.  
  1843. Returns:
  1844.  
  1845.    if function successful
  1846.    Carry flag= clear (this function always succeeds in DPMI
  1847.            1.0)
  1848.    AX     = capabilities flags
  1849.  
  1850.            Bits   Significance
  1851.            0      0 = PAGED ACCESSED/DIRTY capability not
  1852.            supported
  1853.                   1 = PAGED ACCESSED/DIRTY capability
  1854.            supported
  1855.            1      0 = EXCEPTIONS RESTARTABILITY capability
  1856.            not supported
  1857.                   1 = EXCEPTIONS RESTARTABILITY capability
  1858.            supported
  1859.            2      0 = DEVICE MAPPING capability not
  1860.            supported
  1861.                   1 = DEVICE MAPPING capability supported
  1862.            3      0 = CONVENTIONAL MEMORY MAPPING
  1863.                      capability not supported
  1864.                   1 = CONVENTIONAL MEMORY MAPPING
  1865.            capability supported
  1866.            4      0 = DEMAND ZERO-FILL capability not
  1867.            supported
  1868.                   1 = DEMAND ZERO-FILL capability supported
  1869.            5      0 = WRITE-PROTECT CLIENT capability not
  1870.            supported
  1871.                   1 = WRITE-PROTECT CLIENT capability
  1872.            supported
  1873.            6      0 = WRITE-PROTECT HOST capability not
  1874.            supported
  1875.                   1 = WRITE-PROTECT HOST capability
  1876.            supported
  1877.            7-15   reserved
  1878.    CX     = reserved, must be 0
  1879.    DX     = reserved, must be 0
  1880.    ES:(E)DI = selector:offset of 128-byte buffer filled in
  1881.            by host with information as follows:
  1882.  
  1883.            Offset   Length   Contents
  1884.            0        1        Host major version number as a
  1885.            decimal number
  1886.            1        1        Host minor version number as a
  1887.            decimal number
  1888.            2        1-126    ASCIIZ (null-terminated) string
  1889.                              identifying the DPMI host
  1890.                              vendor
  1891.  
  1892.    if function unsuccessful
  1893.    Carry flag= set (this function always fails in DPMI 0.9)
  1894.  
  1895. Notes:
  1896.  
  1897. o  PAGE ACCESSED/DIRTY capability means the DPMI host
  1898.    maintains page dirty and accessed bits that can be read
  1899.    and written with the Get and Set Page Attributes
  1900.    functions (Int 31H Functions 0506H and 0507H).  This
  1901.    capability must be supported, and must read and write the
  1902.    hardware-level dirty and accessed bits, if the DPMI host
  1903.    does not provide demand-paged virtual memory.  If the
  1904.    DPMI host does support virtual memory, this capability is
  1905.    optional, and if present gives the client the ability to
  1906.    read and write virtual page dirty and accessed bits
  1907.    maintained by the host.
  1908. o  EXCEPTION RESTARTABILITY capability means that a faulting
  1909.    instruction inside the host kernel can always be
  1910.    restarted if the client's exception handler corrects the
  1911.    reason for the exception and returns.  Exception
  1912.    restartability allows a client to provide virtual memory
  1913.    under a DPMI host without virtual memory, or to support
  1914.    memory-mapped files under any DPMI host.
  1915. o  DEVICE MAPPING capability means that the DPMI host
  1916.    supports the optional Map Device function (Int 31H
  1917.    Function 0508H).
  1918. o  CONVENTIONAL MEMORY MAPPING capability means that the
  1919.    DPMI host supports the optional Map Conventional Memory
  1920.    function (Int 31H Function 0509H).
  1921. o  DEMAND ZERO-FILL capability means the DPMI host
  1922.    guarantees that all committed pages are initialized to
  1923.    zero when they are created.  If this capability is not
  1924.    supported, the contents of newly committed pages are
  1925.    undefined.
  1926.  
  1927. o    WRITE-PROTECT CLIENT capability means the DPMI host
  1928.    guarantees that the client is running at a privilege
  1929.    level such that write protection of pages is effective
  1930.    for the client's accesses and will geneate page faults.
  1931.  
  1932. o  WRITE-PROTECT HOST capability means the DPMI host
  1933.    guarantees that the host has configured the system such
  1934.    that write protection of pages is effective for the
  1935.    host's accesses and will generate page faults.
  1936.  
  1937. o  The host major and minor version numbers are OEM-specific
  1938.    and are not the DPMI version numbers.
  1939.  
  1940.  
  1941.  
  1942. Int 31H Function 0500H [0.9]
  1943.  
  1944. Get Free Memory Information
  1945.  
  1946. Returns information about the amount of available physical
  1947. memory, linear address space, and disk space for page
  1948. swapping.  Since DPMI clients will often run in multitasking
  1949. environments, the information returned by this function
  1950. should only be considered as advisory.  DPMI 1.0 clients
  1951. should avoid use of this function (see the last note of the
  1952. call).
  1953.  
  1954. Call With:
  1955.  
  1956.    AX     = 0500H
  1957.    ES:(E)DI= selector:offset of 48-byte buffer
  1958.  
  1959. Returns:
  1960.  
  1961.    Carry flag= clear (this function always succeeds)
  1962.  
  1963.    and the buffer is filled in with the following
  1964.            information:
  1965.  
  1966.    Offset Length  Contents
  1967.    00H    4       Largest available free block in bytes
  1968.    04H    4       Maximum unlocked page allocation in pages
  1969.    08H    4       Maximum locked page allocation in pages
  1970.    0CH    4       Linear address space size in pages
  1971.    10H    4       Total number of unlocked pages
  1972.    14H    4       Total number of free pages
  1973.    18H    4       Total number of physical pages
  1974.    1CH    4       Free linear address space in pages
  1975.    20H    4       Size of paging file/partition in pages
  1976.    24H    0CH     Reserved, all bytes set to 0FFH
  1977.  
  1978. Notes:
  1979.  
  1980. o  32-bit programs must use ES:EDI to point to the buffer. 
  1981.    16-bit programs should use ES:DI.
  1982. o  Only the first field of the returned structure is
  1983.    guaranteed to contain a valid value.  Any fields that are
  1984.    not supported by the DPMI host will be set by the host to
  1985.    -1 (0FFFFFFFFH) to indicate that the information is not
  1986.    available.
  1987. o  The field at buffer offset 00H specifies the largest
  1988.    block of contiguous linear memory in bytes that could be
  1989.    allocated if the memory were to be allocated and left
  1990.    unlocked.
  1991. o  The field at buffer offset 04H specifies the largest
  1992.    number of pages that could be allocated (the value at
  1993.    offset 00H divided by the page size).
  1994. o  The field at buffer offset 08H specifies the largest
  1995.    block of memory in pages that could be allocated and then
  1996.    locked.
  1997. o  The field at buffer offset 0CH specifies the size of the
  1998.    total linear address space in pages.  This value includes
  1999.    all linear address space that has already been allocated.
  2000. o  The field at buffer offset 10H specifies the total number
  2001.    of pages that are currently un
  2002. locked and could be paged out.  This value also contains any free
  2003.    pages.
  2004. o  The field at buffer offset 14H specifies the number of
  2005.    physical pages that currently are not in use.
  2006. o  The field at offset 18H specifies the total number of
  2007.    physical pages that the DPMI host manages.  This value
  2008.    includes all free, locked, and unlocked physical pages.
  2009. o  The field at offset 20H specifies the size of the DPMI
  2010.    host's paging partition or file in pages.
  2011. o  The size of the pages used by the DPMI host can be
  2012.    obtained with the Get Page Size function (Int 31H
  2013.    Function 0604H).
  2014. o  DPMI 1.0 clients should use Int 31H Function 050BH in
  2015.    preference to this function.  This function is supported
  2016.    in DPMI 1.0 solely for backward compatibility with DPMI
  2017.    0.9.
  2018. Int 31H Function 0501H [0.9]
  2019.  
  2020. Allocate Memory Block
  2021.  
  2022. Allocates and commits a block of linear memory.
  2023.  
  2024. Call With:
  2025.  
  2026.    AX     = 0501H
  2027.    BX:CX  = size of block (bytes, must be nonzero)
  2028.  
  2029. Returns:
  2030.  
  2031.    if function successful
  2032.    Carry flag= clear
  2033.    BX:CX  = linear address of allocated memory block
  2034.    SI:DI  = memory block handle (used to resize and free
  2035.            block)
  2036.  
  2037.    if function unsuccessful
  2038.    Carry flag= set
  2039.    AX     = error code
  2040.            8012H   linear memory unavailable
  2041.            8013H   physical memory unavailable
  2042.            8014H   backing store unavailable
  2043.            8016H   handle unavailable
  2044.            8021H   invalid value (BX:CX = 0)
  2045.  
  2046. Notes:
  2047.  
  2048. o  The allocated block is guaranteed to have at least 
  2049.    paragraph  alignment.
  2050. o  This function always creates committed pages.
  2051. o  This function does not allocate any descriptors for the
  2052.    memory block.  It is the responsibility of the client to
  2053.    allocate and initialize any descriptors needed to access
  2054.    the memory with additional DPMI function calls.
  2055. o  Under DPMI hosts that support virtual memory, the memory
  2056.    block will be allocated unlocked.  The client can lock
  2057.    some or all of the memory after it is allocated with the
  2058.    Lock Linear Region function (Int 31H Function 0600H).
  2059. o  Under many DPMI hosts, allocations by this function are
  2060.    page granular.  This means, for example, that if the DPMI
  2061.    host uses a page size of 4 KB (1000H), an allocation of
  2062.    1001H bytes will actually result in an allocation of
  2063.    2000H bytes.  Therefore, it is best to always allocate
  2064.    memory in multiples of the unit of granularity (under
  2065.    DPMI 0.9, use 4K bytes), which can be obtained with Int
  2066.    31H Function 0604H.
  2067.  
  2068. Int 31H Function 0502H [0.9]
  2069.  
  2070. Free Memory Block
  2071.  
  2072. Frees a memory block that was previously allocated with
  2073. either the Allocate Memory Block function (Int 31H Function
  2074. 0501H) or the Allocate Linear Memory Block function (Int 31H
  2075. Function 0504H).
  2076.  
  2077. Call With:
  2078.  
  2079.    AX     = 0502H
  2080.    SI:DI  = memory block handle
  2081.  
  2082. Returns:
  2083.  
  2084.    if function successful
  2085.    Carry flag= clear
  2086.  
  2087.    if function unsuccessful
  2088.    Carry flag= set
  2089.    AX     = error code
  2090.            8023H   invalid handle
  2091.  
  2092. Notes:
  2093.  
  2094. o  This call will correctly free all of the possible page
  2095.    types that can occur in a memory block: committed pages,
  2096.    uncommitted pages, and mapped pages (see Appendix A:
  2097.    Glossary).
  2098.  
  2099. o  No descriptors are freed by this call.  It is the
  2100.    client's responsibility to free any descriptors that it
  2101.    previously allocated to map the memory block. 
  2102.    Descriptors should be freed before linear memory blocks.
  2103.  
  2104. Int 31H Function 0503H [0.9]
  2105.  
  2106. Resize Memory Block
  2107.  
  2108. Changes the size of a memory block that was previously
  2109. allocated with either the Allocate Memory Block function
  2110. (Int 31H Function 0501H) or the Allocate Linear Memory Block
  2111. function (Int 31H Function 0504H).
  2112.  
  2113. Call With:
  2114.  
  2115.    AX     = 0503H
  2116.    BX:CX  = new size of block (bytes, must be nonzero)
  2117.    SI:DI  = memory block handle
  2118.  
  2119. Returns:
  2120.  
  2121.    if function successful
  2122.    Carry flag= clear
  2123.    BX:CX  = new linear address of memory block
  2124.    SI:DI  = new handle for memory block
  2125.  
  2126.    if function unsuccessful
  2127.    Carry flag= set
  2128.    AX     = error code
  2129.            8012H   linear memory unavailable
  2130.            8013H   physical memory unavailable
  2131.            8014H   backing store unavailable
  2132.            8016H   handle unavailable
  2133.            8021H   invalid value (BX:CX = 0)
  2134.            8023H   invalid handle (in SI:DI)
  2135.  
  2136. Notes:
  2137.  
  2138. o  After this function returns, the previous handle for the
  2139.    memory block is invalid and should not be used.
  2140. o  When increasing the size of a block, this function always
  2141.    creates committed pages.  When decreasing the block size,
  2142.    this call will correctly free all possible page types
  2143.    (committed pages, uncommitted pages, and mapped pages). 
  2144.    The linear address and handle of the memory block may
  2145.    change  as a result of this call.
  2146. o  It is the client's responsibility to update any
  2147.    descriptors that map the memory block with the new linear
  2148.    address after resizing the block.
  2149. o  This function returns an error if the client attempts to
  2150.    resize a memory block to zero bytes.
  2151.  
  2152. Int 31H Function 0504H [1.0]
  2153.  
  2154. Allocate Linear Memory Block
  2155.  
  2156. Allocates a block of page-aligned linear address space.  The
  2157. base address of the block may be specified by the client,
  2158. and pages within the block may be committed or uncommitted.
  2159.  
  2160. Call With:
  2161.  
  2162.    AX     = 0504H
  2163.    EBX    = desired page-aligned linear address of memory
  2164.            block,
  2165.    or zero if linear address unspecified
  2166.    ECX    = size of block (bytes, must be nonzero)
  2167.    EDX    = flags
  2168.            Bit    Significance
  2169.            0      0 = create uncommitted pages
  2170.                   1 = create committed pages
  2171.            1-31   reserved, should be zero
  2172.  
  2173. Returns:
  2174.  
  2175.    if function successful
  2176.    Carry flag= clear
  2177.    EBX    = linear address of memory block
  2178.    ESI    = handle for memory block
  2179.  
  2180.    if function unsuccessful
  2181.    Carry flag= set
  2182.    AX     = error code
  2183.            8001H   unsupported function (16-bit host)
  2184.            8012H   linear memory unavailable
  2185.            8013H   physical memory unavailable
  2186.            8014H   backing store unavailable
  2187.            8016H   handle unavailable
  2188.            8021H   invalid value (ECX = 0)
  2189.            8025H   invalid linear address (EBX not page
  2190.                    aligned)
  2191.  
  2192. Notes:
  2193.  
  2194. o  A DPMI 1.0 host that is 16-bit only will not support this
  2195.    function.
  2196. o  A 16-bit client of a 32-bit DPMI 1.0 host can use this
  2197.    function.
  2198. o  The allocated block is always page-aligned.  If a
  2199.    specific linear address is not requested (EBX = 0), the
  2200.    DPMI host allocates the memory block at any available
  2201.    page-aligned linear address.  If a specific linear
  2202.    address is requested (EBX nonzero), the host either
  2203.    allocates the block at the specified address or returns
  2204.    error code 8012H (linear memory unavailable).
  2205.  
  2206. o  Int 31H Function 0501H, which can also be used to
  2207.    allocate linear memory blocks, does not necessarily
  2208.    page-align its blocks and does not have the ability to
  2209.    create uncommitted pages or allocate a block at a
  2210.    specific linear address. 
  2211. Int 31H Function 0505H [1.0]
  2212.  
  2213. Resize Linear Memory Block
  2214.  
  2215. Changes the size of a memory block that was previously
  2216. allocated with the Allocate Linear Memory Block function
  2217. (Int 31H Function 0504H).
  2218.  
  2219. Call With:
  2220.  
  2221.    AX     = 0505H
  2222.    ESI    = memory block handle
  2223.    ECX    = new block size (bytes, must be nonzero)
  2224.    EDX    = flags
  2225.            Bit    Significance
  2226.            0      0 = create uncommitted pages
  2227.                   1 = create committed pages
  2228.            1      0 = do not update segment descriptors
  2229.                   1 = segment descriptor update required
  2230.            2-31   reserved, must be zero
  2231.  
  2232.    and, if bit 1 of EDX is set (1):
  2233.    ES:EBX = selector:offset of a buffer containing an array
  2234.            of selectors, 1 word (16 bits) per selector
  2235.    EDI    = count of selectors in array
  2236.  
  2237. Returns:
  2238.  
  2239.    if function successful
  2240.    Carry flag= clear
  2241.    EBX    = new linear base address of memory block
  2242.    ESI    = new handle for memory block
  2243.  
  2244.    if function unsuccessful
  2245.    Carry flag= set
  2246.    AX     = error code
  2247.            8001H   unsupported function (16-bit host)
  2248.            8012H   linear memory unavailable
  2249.            8013H   physical memory unavailable
  2250.            8014H   backing store unavailable
  2251.            8016H   handle unavailable
  2252.            8021H   invalid value (ECX=0)
  2253.            8023H   invalid handle (in ESI)
  2254.  
  2255. Notes:
  2256.  
  2257. o  A DPMI 1.0 host that is 16-bit only will not support this
  2258.    function.
  2259. o  A 16-bit client of a 32-bit DPMI 1.0 host can use this
  2260. function.
  2261. o  After this function returns, the previous handle for the
  2262.    memory block is invalid and should not be used.
  2263. o  If this function fails, the block's size and base address
  2264.    are always unmodified. 
  2265. o  If the size of the block is increased, the new pages are
  2266.    committed or uncommitted according to the value of bit 0
  2267.    of EDX, and the block's linear base address may change. 
  2268.    If the size of the block is decreased, pages at the end
  2269.    of the block are freed, and the block's base address is
  2270.    always unchanged.
  2271. o  If the block's linear base address is changed by this
  2272.    function, and the function was called with bit 1 of EDX 
  2273.    set (1), the DPMI host updates the descriptors f
  2274. or each of the segments in the update list which fall within the
  2275.    memory block.  Descriptors for segments which do not fall
  2276.    within the memory block are not modified.  Expand-up
  2277.    segments fall within the memory block if the segment base
  2278.    is within the block.   Expand-down segments fall within
  2279.    the memory block if the (segment base + the limit - 1) is
  2280.    within the block.  In either case, the segment base is
  2281.    modified by the distance the block moves, and the segment
  2282.    limit is not changed. The moving of the memory block and
  2283.    the updating of descriptors is performed atomically; i.e.
  2284.    the host will not deliver any hardware interrupts to the
  2285.    client during the update.
  2286. o  Int 31H Function 0503H, which also resizes linear memory
  2287.    blocks, does not necessarily page-align blocks and cannot
  2288.    create uncommitted pages or update descriptors.
  2289. Int 31H Function 0506H [1.0]
  2290.  
  2291. Get Page Attributes
  2292.  
  2293. Returns the attributes of one or more pages within a linear
  2294. memory block previously allocated with Int 31H Function
  2295. 0504H.
  2296.  
  2297. Call With:
  2298.  
  2299.    AX     = 0506H
  2300.    ESI    = memory block handle
  2301.    EBX    = base offset in memory block of page (or of first
  2302.            page, if requesting attributes for multiple
  2303.            pages)
  2304.    ECX    = number of pages
  2305.    ES:EDX = selector:offset of a buffer to receive page
  2306.            attributes, 1 word (16-bits) per page (see Note)
  2307.  
  2308. Returns:
  2309.  
  2310.    if function successful
  2311.    Carry flag= clear
  2312.  
  2313.    and buffer at ES:EDX filled in with page attributes (see
  2314.    Note)
  2315.  
  2316.    if function unsuccessful
  2317.    Carry flag= set
  2318.    AX     = error code
  2319.            8001H   unsupported function (16-bit host)
  2320.            8023H   invalid handle (in ESI)
  2321.            8025H   invalid linear address (Specified range
  2322.                    is not within specified block)
  2323.  
  2324. Notes:
  2325.  
  2326. o  A DPMI 1.0 host that is 16-bit only will not support this
  2327.    function.
  2328. o  A 16-bit client of a 32-bit DPMI 1.0 host can use this
  2329.    function.
  2330. o  If EBX is not aligned, it will be rounded down to the
  2331.    next lower page boundary.
  2332. o  The specified buffer is filled in by the DPMI host with
  2333.    the attributes of the requested pages, 1 word (16-bits)
  2334.    per page, in the following format:
  2335.  
  2336.    Bits      Significance
  2337.    0-2       page type (0-7)
  2338.              Value  Meaning
  2339.              0      uncommitted page
  2340.              1      committed page
  2341.              2      mapped page
  2342.              3-7    currently unused
  2343.    3         0 = page is read-only
  2344.              1 = page is read/write
  2345.    4         0 = accessed/dirty bits not available for this
  2346.    page
  2347.              1 = accessed/dirty bits are supplied for this
  2348.    page in bits 5-6
  2349.    5         0 = page has not been accessed (if bit 4=1)
  2350.              1 = page has been accessed (if bit 4=1)
  2351.    6         0 = page has not been modified (if bit 4=1)
  2352.              1 = page has been modified (if bit 4=1)
  2353.    7-15      reserved, currently zero
  2354.  
  2355. o  Mapped pages can only occur in memory blocks under DPMI 
  2356.    hosts that support the Device Mapping capability or the
  2357.    Conventional Memory Mapping capability.  See Int 31H
  2358.    Functions 0401H, 0508H, and 0509H.
  2359. o  The dirty and accessed bits are only supplied if the DPMI
  2360.    host supports the Page Accessed/Dirty capability.  DPMI
  2361.    hosts that support this capability are required to return
  2362.    dirty and accessed bits for all committed pages and for
  2363.    mapped pages created with the Map Conventional Memory
  2364.    call (Int 31H Function 0509H).  However, dirty and
  2365.    accessed bits may not be returned for individual mapped
  2366.    pages created with the Map Device call (Int 31H Function
  2367.    0508H) if the host is using page table entries (PTEs) to
  2368.    virtualize the device.
  2369. Int 31H Function 0507H [1.0]
  2370.  
  2371. Set Page Attributes
  2372.  
  2373. Sets the attributes of one or more pages within a linear
  2374. memory block previously allocated with Int 31H Function 
  2375. 0504H.  This function can be used to change a committed page
  2376. or a mapped page to an uncommitted page, change an
  2377. uncommitted page or a mapped page to a committed page, or
  2378. modify the read/write bit and optionally the accessed and
  2379. dirty bits on a committed or mapped page.
  2380.  
  2381. Call With:
  2382.  
  2383.    AX     = 0507H
  2384.    ESI    = memory block handle
  2385.    EBX    = offset within memory block of page(s) whose
  2386.            attributes are to be modified
  2387.    ECX    = number of pages
  2388.    ES:EDX = selector:offset of a buffer containing page
  2389.            attributes, 1 word (16-bits) per page (see Note)
  2390.  
  2391. Returns:
  2392.  
  2393.    if function successful
  2394.    Carry flag= clear
  2395.  
  2396.    if function unsuccessful
  2397.    Carry flag= set
  2398.    AX     = error code
  2399.            8001H   unsupported function (16-bit host)
  2400.            8002H   invalid state (page in wrong state for
  2401.                    request)
  2402.            8013H   physical memory unavailable
  2403.            8014H   backing store unavailable
  2404.            8021H   invalid value (illegal request in bits
  2405.                    0-2 of one or more page attribute words)
  2406.            8023H   invalid handle (in ESI)
  2407.            8025H   invalid linear address (specified range
  2408.                    is not within specified block)
  2409.  
  2410.    ECX    = number of pages that have been set
  2411.  
  2412. Notes:
  2413.  
  2414. o  A DPMI 1.0 host that is 16-bit only will not support this
  2415.    function.
  2416. o  A 16-bit client of a 32-bit DPMI 1.0 host can use this
  2417.    function.
  2418. o  If EBX is not aligned, it will be rounded down to the
  2419.    next lower page boundary.
  2420. o  An uncommitted page can be created from:
  2421.   a committed page, by releasing the physical memory or
  2422.    backing store allocated to the page;
  2423.   a mapped page, by marking it uncommitted; or
  2424.    an uncommitted page, by doing nothing.
  2425.  
  2426.  
  2427. o  A committed page can be created from:
  2428.   an uncommitted page or mapped page, by allocating
  2429.    physical memory or backing store (with undefined, or
  2430.    zero-filled contents) for the page; or
  2431.   a committed page, by doing nothing (page contents
  2432.    unmodified).
  2433.  
  2434. o  The attribute word (16-bits) specified for a page has the
  2435.     following format (bits 3-6 are only relevant if page is
  2436.    being created committed or its attributes are being
  2437.    modified, i.e. the value in bits 0-2 of the page
  2438.    attribute is 1 or 3):
  2439.  
  2440.    Bits      Significance
  2441.    0-2       page type (0-7)
  2442.              Value  Meaning
  2443.              0      create page uncommitted
  2444.              1      create page committed
  2445.              2      not allowed
  2446.              3      modify attributes without changing page
  2447.    type
  2448.              4-7    not allowed
  2449.    3         0 = page is read-only
  2450.              1 = page is read/write
  2451.    4         0 = don't modify accessed/dirty bits for page
  2452.              1 = set accessed/dirty bits as specified in
  2453.    bits 5-6
  2454.    5         0 = mark page as not accessed (if bit 4=1)
  2455.              1 = mark page as accessed (if bit 4=1)
  2456.    6         0 = mark page as not dirty (if bit 4=1)
  2457.              1 = mark page as dirty (if bit 4=1)
  2458.    7-15      reserved, should be zero
  2459.  
  2460. o  This function, and the optional Map Device and Map
  2461.    Conventional Memory functions (Int 31H Functions 0508H
  2462.    and 0509H), are the only means of changing the type of a
  2463.    page within an existing memory block.
  2464. o  The page read/write bit, and optionally the accessed and
  2465.    dirty bits, can be modified on an existing committed or
  2466.    mapped page, or on a committed page when it is initially
  2467.    created from an uncommitted page or a mapped page. 
  2468.    However, the accessed and dirty bits are ignored if the
  2469.    host does not support the Page Accessed/Dirty capability. 
  2470.    See Int 31H Function 0401H.
  2471.  
  2472. o  Visible page faults (page faults that can be serviced by
  2473.    a client-installed exception handler) can only occur for
  2474.    uncommitted pages or read-only pages (for definitions of
  2475.    transparent page fault and visible page fault, see
  2476.    Appendix A: Glossary).
  2477. Int 31H Function 0508H [Optional]  [1.0]
  2478.  
  2479. Map Device in Memory Block
  2480.  
  2481. Maps the physical addresses assigned to a device onto the
  2482. linear addresses of a memory block previously allocated with
  2483. Int 31H Function 0504H.
  2484.  
  2485. Call With:
  2486.  
  2487.    AX     = 0508H
  2488.    ESI    = memory block handle
  2489.    EBX    = offset within memory block of page(s) to be
  2490.            mapped (must be page-aligned)
  2491.    ECX    = number of pages to map
  2492.    EDX    = physical address of device (must be
  2493.            page-aligned)
  2494.  
  2495. Returns:
  2496.  
  2497.    if function successful
  2498.    Carry flag= clear
  2499.  
  2500.    if function unsuccessful
  2501.    Carry flag= set
  2502.    AX     = error code
  2503.            8001H   unsupported function (Device Mapping
  2504.                    Capability not supported)
  2505.            8003H   system integrity (invalid device address)
  2506.            8023H   invalid handle (in ESI)
  2507.            8025H   invalid linear address (specified range
  2508.                    is not within specified block or EBX/EDX
  2509.                    is not page-aligned)
  2510.  
  2511. Notes:
  2512.  
  2513. o  16-bit DPMI hosts will not support this function.  A
  2514.    16-bit client of a 32-bit DPMI 1.0 host can use this
  2515.    function.
  2516. o  Support of this call by 32-bit DPMI hosts is optional. 
  2517.    Application programs or DOS Extenders which require this
  2518.    call in order to run are not DPMI Compliant.
  2519. o  Any committed or mapped pages resided in the linear
  2520.    address range that is being mapped into will be
  2521.    uncommitted or unmapped automatically by the host.
  2522. o  All pages created by this call have the mapped bit (bit
  2523.    2) set in the attributes returned by the Get Page
  2524.    Attributes function (Int 31H Function 0506H).
  2525. o  This functio
  2526. n differs from the Create Physical Address Mapping function (Int 31H
  2527.    Function 0800H) in that this function supports mapping of
  2528.    physical devices within an existing memory block, rather
  2529.    than at an arbitrary linear address.  Use of an existing
  2530.    memory block gives 32-bit programs the ability to access
  2531.    physical devices with NEAR pointers, which is often
  2532.    highly desirable for performance reasons.
  2533. o  Unlike Int 31H Function 0800H, this function allows
  2534.    mapping of  addresses below 1 MB that do not lie within
  2535.    RAM available for use by programs; e.g. this function can
  2536.     be used to map the refresh buffers of IBM-compatible
  2537.    display adapters.
  2538. o  If the DPMI host is not virtualizing the device,  it must
  2539.    disable any memory caching on the mapped pages;  in
  2540.    particular, on the 486 or later, the PCD (page cache
  2541.    disable) bit must be set in the page table entries.
  2542. o  DPMI hosts that do not virtualize physical devices can
  2543.    support this function by creating page table entries that
  2544.    map the physical device.  The page table entries must be
  2545.    marked as mapped so that the host knows not to attempt
  2546.    freeing of physical memory for the pages when the memory
  2547.    block is freed.
  2548. o  DPMI hosts are allowed to support this function for some
  2549.    physical devices and not for others, because mapping of
  2550.    virtualized devices requires page aliasing in the host -
  2551.    a complex task.  DPMI hosts with partial support for this
  2552.    function may fail the function call on virtualized
  2553.    devices (such as displays), and allow the call on
  2554.    non-virtualized devices (such as the Weitek
  2555.    coprocessors).  Allowing the client to map  a physical
  2556.    device so that it can be accessed with NEAR references,
  2557.    for example, may help the client achieve considerably
  2558.    better performance.
  2559. Int 31H Function 0509H [Optional]  [1.0]
  2560.  
  2561. Map Conventional Memory in Memory Block
  2562.  
  2563. Aliases linear  addresses below the 1 MB boundary onto the
  2564. linear addresses of a memory block previously allocated with
  2565. Int 31H Function  0504H.
  2566.  
  2567. Call With:
  2568.  
  2569.    AX     = 0509H
  2570.    ESI    = memory block handle
  2571.    EBX    = offset within memory block of page(s) to be
  2572.            mapped (must be page-aligned)
  2573.    ECX    = number of pages to map
  2574.    EDX    = linear address of conventional memory (must be
  2575.            page-aligned)
  2576.  
  2577. Returns:
  2578.  
  2579.    if function successful
  2580.    Carry flag= clear
  2581.  
  2582.    if function unsuccessful
  2583.    Carry flag= set
  2584.    AX     = error code
  2585.            8001H   unsupported function (Conventional Memory
  2586.                    Mapping Capability not supported)
  2587.            8003H   system integrity (invalid conventional
  2588.                    memory address)
  2589.            8023H   invalid handle (in ESI)
  2590.            8025H   invalid linear address (specified range
  2591.                    is not within specified block, or EBX/EDX
  2592.                    is not page aligned)
  2593.  
  2594. Notes:
  2595.  
  2596. o  16-bit DPMI hosts will not support this function.  A
  2597.    16-bit client of a 32-bit DPMI 1.0 host can use this
  2598.    function.
  2599. o  Support of this call by 32-bit DPMI hosts is optional. 
  2600.    Application programs or DOS Extenders which require this
  2601.    call in order to run are not DPMI Compliant.
  2602. o  Any committed or mapped pages resided in the linear
  2603.    address range that is being mapped into will be
  2604.    uncommitted or unmapped automatically by the host.
  2605. o  A client may only map conventional memory that it already
  2606.    owns; i.e. memory which the client previously allocated
  2607.    with Int 31H Function 0100H or by calling DOS's Int 21H
  2608.    Function 48H directly via the translation services.
  2609. o  All pages created by this call have the mapped bit (bit
  2610.    2) set in the attributes returned by the Get Page
  2611.    Attributes function (Int 31H Function 0506H).
  2612. o  DPMI hosts that do not implement virtual memory can
  2613.    support this function by simply copying page table
  2614.    entries.  The entries must be marked as mapped so that
  2615.    the host knows not to free up those physical pages when
  2616.    the memory block is freed.
  2617. o  DPMI hosts that provide virtual memory must implement
  2618.    some form of page aliasing in order to support this
  2619.    function.
  2620. o  The function can provide a large contiguous memory space
  2621.    without virtual memory support. 
  2622.  
  2623.   Implementors of DPMI hosts which do not provide virtual
  2624.    memory are encouraged to support this function.  Without
  2625.    this function, conventional memory may be inaccessible to
  2626.    a 32-bit nonsegmented client, because the client may need
  2627.    contiguous linear memory for its code and data.  32-bit
  2628.    clients can always guarantee that conventional memory is
  2629.    not wasted with the following strategy:
  2630.  
  2631.   Call DOS to allocate any free conventional memory
  2632.   If the DPMI host supports virtual memory, call the Mark
  2633.    Real Mode Region Pageable function (Int 31H Function
  2634.    0602H) to ensure that the host has not locked down
  2635.    conventional memory.
  2636.   If the host does not support virtual memory but supports
  2637.    the Map Conventional Memory function (Int 31H Function
  2638.    0509H), allocate a memory block with uncommitted pages,
  2639.    then use Function 0509H to make the physical memory
  2640.    allocated below 640 KB addressable in the memory block,
  2641.    and therefore useable by the 32-bit application program.
  2642. Int 31H Function 050AH [1.0]
  2643.  
  2644. Get Memory Block Size and Base
  2645.  
  2646. Returns the size of a memory block that was previously
  2647. allocated with Int 31H Function 0501H or 0504H.
  2648.  
  2649. Call With:
  2650.  
  2651.    AX     = 050AH
  2652.    SI:DI  = memory block handle
  2653.  
  2654. Returns:
  2655.  
  2656.    if function successful
  2657.    Carry flag= clear
  2658.    SI:DI  = size of memory block (bytes)
  2659.  
  2660.    BX:CX  = base address of memory block if function
  2661.            unsuccessful
  2662.    Carry flag= set
  2663.    AX     = error code
  2664.            8023H   invalid handle
  2665. Int 31H Function 050BH [1.0]
  2666.  
  2667. Get Memory Information
  2668.  
  2669. Returns information about available physical and virtual
  2670. memory.  Since DPMI clients will often run in multitasking
  2671. environments, some of information related to shared
  2672. resources returned by this function should only be
  2673. considered as advisory.
  2674.  
  2675. Call With:
  2676.  
  2677.    AX     = 050BH
  2678.    ES:(E)DI= selector:offset of 128-byte buffer
  2679.  
  2680. Returns:
  2681.  
  2682.    if function successful
  2683.    Carry flag= clear (this function always succeeds in DPMI
  2684.            1.0)
  2685.  
  2686.    and the buffer pointed to by ES:(E)DI is filled in with
  2687.            the following information:
  2688.  
  2689.    Offset Length  Contents
  2690.    00H    4       Total allocated bytes of physical memory
  2691.    controlled by DPMI host
  2692.    04H    4       Total allocated bytes of virtual memory
  2693.    controlled by DPMI host
  2694.    08H    4       Total available bytes of virtual memory
  2695.    controlled by DPMI host
  2696.    0CH    4       Total allocated bytes of virtual memory
  2697.    for this virtual machine
  2698.    10H    4       Total available bytes of virtual memory
  2699.    for this virtual machine
  2700.    14H    4       Total allocated bytes of virtual memory
  2701.    for this client
  2702.    18H    4       Total available bytes of virtual memory
  2703.    for this client
  2704.    1CH    4       Total locked bytes of memory for this
  2705.    client
  2706.    20H    4       Maximum locked bytes of memory for this
  2707.    client
  2708.    24H    4       Highest linear address available to this
  2709.    client
  2710.    28H    4       Size in bytes of largest available free
  2711.    memory block
  2712.    2CH    4       Size of minimum allocation unit in bytes
  2713.    30H    4       Size of the allocation alignment unit in
  2714.    bytes
  2715.    34H    4CH     Reserved, currently zero
  2716.  
  2717.    if function unsuccessful
  2718.    Carry flag= set (this function always fails in DPMI 0.9)
  2719.  
  2720. Notes:
  2721.  
  2722. o  DPMI 1.0 clients should use this function in preference
  2723.    to Int 31H Function 0500H.
  2724. o  The "total available bytes" field of the data structure
  2725.    pointed by ES:(E)DI means the total bytes minus all of
  2726.    the allocated bytes.
  2727. Int 31H Function 0600H [0.9]
  2728.  
  2729. Lock Linear Region
  2730.  
  2731. Locks the specified linear address range.
  2732.  
  2733. Call With:
  2734.  
  2735.    AX     = 0600H
  2736.    BX:CX  = starting linear address of memory to lock
  2737.    SI:DI  = size of region to lock (bytes)
  2738.  
  2739. Returns:
  2740.  
  2741.    if function successful
  2742.    Carry flag= clear
  2743.  
  2744.    if function unsuccessful
  2745.    Carry flag= set
  2746.    AX     = error code
  2747.            8013H   physical memory unavailable
  2748.            8017H   lock count exceeded
  2749.            8025H   invalid linear address (unallocated
  2750.                    pages)
  2751.  
  2752. Notes:
  2753.  
  2754. o  If the function returns an error, none of the memory has
  2755.    been locked.
  2756. o  If the specified region overlaps part of a page at the
  2757.    beginning or end of the region, the page(s) will be
  2758.    locked.
  2759. o  This function may be called more than once for a given
  2760.    page; the DPMI host maintains a lock count for each page.
  2761. o  This function is ignored by DPMI implementations that do
  2762.    not support virtual memory; the function will return the
  2763.    Carry flag clear to indicate success, but has no other
  2764.    effect.  DPMI hosts which support virtual memory may also
  2765.    choose to ignore this function, but such hosts must be
  2766.    able to handle page faults transparently at arbitrary
  2767.    points during a client's execution, including within
  2768.    interrupt and exception handlers.
  2769. Int 31H Function 0601H [0.9]
  2770.  
  2771. Unlock Linear Region
  2772.  
  2773. Unlocks a linear address range that was previously locked
  2774. using the Lock Linear Region function (Int 31H Function
  2775. 0600H).
  2776.  
  2777. Call With:
  2778.  
  2779.    AX     = 0601H
  2780.    BX:CX  = starting linear address of memory to unlock
  2781.    SI:DI  = size of region to unlock (bytes)
  2782.  
  2783. Returns:
  2784.  
  2785.    if function successful
  2786.    Carry flag= clear
  2787.  
  2788.    if function unsuccessful
  2789.    Carry flag= set
  2790.    AX     = error code
  2791.            8002H   invalid state (page not locked)
  2792.            8025H   invalid linear address (unallocated
  2793.                    pages)
  2794.  
  2795. Notes:
  2796.  
  2797. o  If the function returns an error, none of the memory has
  2798.    been unlocked.
  2799. o  If the specified region overlaps part of a page at the
  2800.    beginning or end of the region, the page(s) will be
  2801.    unlocked.
  2802. o  A lock count is maintained for each locked page; the page
  2803.    is not unlocked until the lock count is decremented to
  2804.    zero (i.e. the number of Lock Region Int 31H Function
  2805.    0600H calls has been balanced by the same number of
  2806.    Unlock Region Int 31H Function 0601H calls).
  2807. o  This function is ignored by DPMI implementations that do
  2808.    not support virtual memory; the function will return the
  2809.    Carry flag clear to indicate success, but has no other
  2810.    effect.  DPMI hosts which support virtual memory may also
  2811.    choose to ignore this function, but such hosts must be
  2812.    able to handle page faults transparently at arbitrary
  2813.    points during a client's execution, including within
  2814.    interrupt and exception handlers.
  2815. Int 31H Function 0602H [0.9]
  2816.  
  2817. Mark Real Mode Region as Pageable
  2818.  
  2819. Advises the DPMI host that the specified memory below the 1
  2820. MB boundary may be paged to disk.
  2821.  
  2822. Call With:
  2823.  
  2824.    AX     = 0602H
  2825.    BX:CX  = starting linear address of memory to mark as
  2826.            pageable
  2827.    SI:DI  = size of region to be marked (bytes)
  2828.  
  2829. Returns:
  2830.  
  2831.    if function successful
  2832.    Carry flag= clear
  2833.  
  2834.    if function unsuccessful
  2835.    Carry flag= set
  2836.    AX     = error code
  2837.            8002H   invalid state (region already marked as
  2838.                    pageable)
  2839.            8025H   invalid linear address (region is above 1
  2840.                    MB boundary)
  2841.  
  2842. Notes:
  2843.  
  2844. o  If the function returns an error, none of the memory has
  2845.    been marked as pageable.
  2846. o  If the specified region overlaps part of a page at the
  2847.    beginning or end of the region, the page(s) will not be
  2848.    marked as pageable.
  2849. o  Pageability information for a real mode region is
  2850.    maintained as a binary state, not a count.  Therefore,
  2851.    multiple calls to this function for the same region have
  2852.    no effect.
  2853. o  For compatibility with DPMI version 0.9 hosts, a client
  2854.    must call the Relock Real Mode Region function (Int 31H
  2855.    Function 0603H) to relock the memory region before
  2856.    terminating.  Memory that remains unlocked after the
  2857.    client has terminated could result in fatal page faults
  2858.    when another program is executed in the same address
  2859.    space.  DPMI 1.0 hosts automatically relock real mode
  2860.    memory at client termination.
  2861. o  Under some DPMI hosts, all conventional memory may be
  2862.    locked by default.  If a protected mode program is using
  2863.    memory in the first megabyte of address space, it is
  2864.    recommended that this function be used to turn off
  2865.    automatic page locking for regions of memory that will
  2866.    not be touched at interrupt time.
  2867. o  The client must not mark memory as pageable in regions
  2868.    that it does not own; i.e. it may only mark as pageable
  2869.    memory that it has previously allocated with Int 31H
  2870.    Function 0100H or by a direct call to DOS via the
  2871.    translation functions.  For example, marking all free DOS
  2872.    memory as pageable under some DPMI hosts could cause a
  2873.    page fault to occur while inside of DOS, resulting in a
  2874.    crash.  Also, a client should not mark the DPMI host data
  2875.    area as pageable.
  2876. o  Note that address space marked as pageable by this
  2877.    function can still be locked using the Lock Linear Region
  2878.     function (Int 31H Function 0600H).  This function is
  2879.    just an advisory service to allow memory that does not
  2880.    need to be locked to be paged out; it disables any
  2881.    automatic locking of real mode memory performed by the
  2882.    DPMI host.
  2883. o  This function is ignored by DPMI implementations that do
  2884.    not support virtual memory; the function will return the
  2885.    Carry flag clear to indicate success, but has no other
  2886.    effect.  DPMI hosts which support virtual memory may also
  2887.    choose to ignore this function, but such hosts must be
  2888.    able to handle page faults transparently at arbitrary
  2889.    points during a client's execution, including within
  2890.    interrupt and exception handlers.
  2891. Int 31H Function 0603H [0.9]
  2892.  
  2893. Relock Real Mode Region
  2894.  
  2895. Relocks a memory region that was previously declared as
  2896. pageable with the Mark Real Mode Region as Pageable function
  2897. (Int 31H Function 0602H).
  2898.  
  2899. Call With:
  2900.  
  2901.    AX     = 0603H
  2902.    BX:CX  = starting linear address of memory to relock
  2903.    SI:DI  = size of region to relock (bytes)
  2904.  
  2905. Returns:
  2906.  
  2907.    if function successful
  2908.    Carry flag= clear
  2909.  
  2910.    if function unsuccessful
  2911.    Carry flag= set
  2912.    AX     = error code
  2913.            8002H   invalid state (region not marked as
  2914.                    pageable)
  2915.            8013H   physical memory unavailable
  2916.            8025H   invalid linear address (region is above 1
  2917.                    MB boundary)
  2918.  
  2919. Notes:
  2920.  
  2921. o  If the function returns an error, none of the memory has
  2922.    been relocked.
  2923. o  If the specified region overlaps part of a page at the
  2924.    beginning or end of the region, the page(s) will not be
  2925.    relocked.
  2926. o  This function is ignored by DPMI implementations that do
  2927.    not support virtual memory; the function will return the
  2928.    Carry flag clear to indicate success, but has no other
  2929.    effect.  DPMI hosts which support virtual memory may also
  2930.    choose to ignore this function, but such hosts must be
  2931.    able to handle page faults transparently at arbitrary
  2932.    points during a client's execution, including within
  2933.    interrupt and exception handlers.
  2934. o  If Function 0602H is implemented as a "no-operation" on a
  2935.    particular DPMI host, this function will likewise do
  2936.    nothing.  In other words, this function should not be
  2937.    used to lock memory, but only to restore the default
  2938.    state of the host's conventional memory locking.
  2939. Int 31H Function 0604H [0.9]
  2940.  
  2941. Get Page Size
  2942.  
  2943. Returns the size of a single memory page in bytes.
  2944.  
  2945. Call With:
  2946.  
  2947.    AX     = 0604H
  2948.  
  2949. Returns:
  2950.  
  2951.    if function successful
  2952.    Carry flag= clear
  2953.    BX:CX  = page size in bytes
  2954.  
  2955.    if function unsuccessful
  2956.    Carry flag= set
  2957.    AX     = error code
  2958.            8001H   unsupported function (16-bit host)
  2959. Int 31H Function 0700H [0.9]
  2960.  
  2961. Reserved
  2962.  
  2963. Function 0700H is reserved for historical reasons and should
  2964. not be called.
  2965. Int 31H Function 0701H [0.9]
  2966.  
  2967. Reserved
  2968.  
  2969. Function 0701H  is reserved for historical reasons and
  2970. should not be called.
  2971. Int 31H Function 0702H [0.9]
  2972.  
  2973. Mark Page as Demand Paging Candidate
  2974.  
  2975. Notifies the DPMI host that a range of pages may be placed
  2976. at the head of the page-out candidate list, forcing these
  2977. pages to be replaced ahead of other pages even if the memory
  2978. has been accessed recently.  The contents of the pages will
  2979. be preserved.
  2980.  
  2981. Call With:
  2982.  
  2983.    AX     = 0702H
  2984.    BX:CX  = starting linear address of pages to mark as
  2985.            paging candidates
  2986.    SI:DI  = size of region to mark (bytes)
  2987.  
  2988. Returns:
  2989.  
  2990.    if function successful
  2991.    Carry flag= clear
  2992.  
  2993.    if function unsuccessful
  2994.    Carry flag= set
  2995.    AX     = error code
  2996.            8025H   invalid linear address (range
  2997.                    unallocated)
  2998.  
  2999. Notes:
  3000.  
  3001. o  This function does not force the pages to be swapped to
  3002.    disk immediately and should be treated as advisory only.
  3003. o  This function will always succeed on hosts that do not
  3004.    implement demand-paged virtual memory.
  3005. o  Partial pages will not be marked.
  3006. o  This function is useful, for example, if a client knows
  3007.    that a given piece of data will not be accessed for a
  3008.    long period of time.  That data is ideal for swapping to
  3009.    disk so that the physical memory it occupies can be used
  3010.    for other purposes.
  3011. Int 31H Function 0703H [0.9]
  3012.  
  3013. Discard Page Contents
  3014.  
  3015. Discards the entire contents of a given linear memory range. 
  3016. This function is used when a memory object (such as a data
  3017. structure) that occupies a given area of memory is no longer
  3018. needed, so that the area will not be paged to disk
  3019. unnecessarily.  The contents of the discarded region will be
  3020. undefined.
  3021.  
  3022. Call With:
  3023.  
  3024.    AX     = 0703h
  3025.    BX:CX  = starting linear address of pages to discard
  3026.    SI:DI  = size of region to discard (bytes)
  3027.  
  3028. Returns:
  3029.  
  3030.    if function successful
  3031.    Carry flag= clear
  3032.  
  3033.    if function unsuccessful
  3034.    Carry flag= set
  3035.    AX     = error code
  3036.            8025H   invalid linear address (range
  3037.                    unallocated)
  3038.  
  3039. Notes:
  3040.  
  3041. o  Partial pages and locked pages will not be discarded.
  3042. Int 31H Function 0800H [0.9]
  3043.  
  3044. Physical Address Mapping
  3045.  
  3046. Converts a physical address into a linear address.
  3047.   This function allows device drivers running under DPMI
  3048. hosts which use paging to reach physical memory that is
  3049. associated with their devices above the 1 MB boundary  
  3050. Examples of such devices are the Weitek numeric coprocessor
  3051. (usually mapped at 3 GB), buffers that hold scanner bit
  3052. maps, and high-end displays that can be configured to make
  3053. display memory appear in extended memory.
  3054.  
  3055. Call With:
  3056.  
  3057.    AX     = 0800H
  3058.    BX:CX  = physical address of memory
  3059.    SI:DI  = size of region to map (bytes)
  3060.  
  3061. Returns:
  3062.  
  3063.    if function successful
  3064.    Carry flag= clear
  3065.    BX:CX  = linear address that can be used to access the
  3066.            physical memory
  3067.  
  3068.    if function unsuccessful
  3069.    Carry flag= set
  3070.    AX     = error code
  3071.            8003H   system integrity (DPMI host memory
  3072.                    region)
  3073.            8021H   invalid value (address is below 1 MB
  3074.                    boundary)
  3075.  
  3076. Notes:
  3077.  
  3078. o  It is the caller's responsibility to allocate and
  3079.    initialize a descriptor for access to the memory.
  3080. o  This function should only be used by clients that
  3081.    absolutely require direct access to a memory mapped
  3082.    device at physical addresses above 1 MB.  Clients should
  3083.    not use this function to access memory below the 1 MB
  3084.    boundary (the real mode addressable region).  See also
  3085.    Int 31H Functions 0002H, 0508H, and 0509H.
  3086. o  When this function is called, the DPMI host either
  3087.    creates page table entries that directly map the physical
  3088.    addresses requested and returns the linear address of the
  3089.    created page table entries, or else just returns the
  3090.    linear address of the memory region that is already used
  3091.    to map the requested device.  For example, if the client
  3092.    attempts to map a Weitek coprocessor and the host already
  3093.    has a linear region set up to map the Weitek chip and
  3094.    virtualize it, it would simply return the linear address
  3095.    of the existing region.  If the host does not virtualize
  3096.    the Weitek chip, it would create 16 page table entries
  3097.    that map the 64 KB Weitek address space and return a
  3098.    linear address corresponding to the new page table
  3099.    entries.
  3100. o  If the host is not virtualizing the device, it must
  3101.    disable any memory caching on the mapped pages;  in 
  3102.    particular, on the 80486 the host must set the PCD (page
  3103.    cache disable) bit in the page table entries.
  3104. o  The host is permitted to fail any memory mapping call. 
  3105.    However, the host should support this function whenever
  3106.    possible, to achieve compatibility with application
  3107.    programs that use memory-mapped devices of which the host
  3108.    is not aware.  Useful guidelines are that the host should
  3109.    fail any attempt to map addresses below 1 MB, or
  3110.    addresses which the host considers to be general-purpose
  3111.    RAM memory.  Attempts to map any other physical address
  3112.    should succeed, since the host should either (a) already
  3113.    know about the device and be able to return a linear
  3114.    address used to access the device, or (b) assume the
  3115.    program is attempting to map a legitimate device of which
  3116.    the host has no knowledge.
  3117.  
  3118. o  Programs and device drivers which need to perform DMA I/O
  3119.    to physical addresses in a virtualized hardware
  3120.    environment should use the Virtual DMA Services (see the
  3121.    Glossary entry for the Virtual DMA Services
  3122.    Specification).   Also see page 10 of the DPMI execution
  3123.    environment section.
  3124. Int 31H Function 0801H [1.0]
  3125.  
  3126. Free Physical Address Mapping
  3127.  
  3128. Releases a mapping of physical to linear addresses that was
  3129. previously obtained with the Physical Address Mapping
  3130. function (Int 31H Function 0800H).
  3131.  
  3132. Call With:
  3133.  
  3134.    AX     = 0801H
  3135.    BX:CX  = linear address returned by physical address
  3136.            mapping call
  3137.  
  3138. Returns:
  3139.  
  3140.    if function successful
  3141.    Carry flag= clear
  3142.  
  3143.    if function unsuccessful
  3144.    Carry flag= set
  3145.    AX     = error code
  3146.            8025H   invalid linear address
  3147.  
  3148. Notes:
  3149.  
  3150. o  The client should call this function when it is finished
  3151.    using a device previously mapped to linear addresses with
  3152.    the Physical Address Mapping function (Int 31H Function
  3153.    0800H). 
  3154. Int 31H Function 0900H [0.9]
  3155.  
  3156. Get and Disable Virtual Interrupt State
  3157.  
  3158. Disables the virtual interrupt flag and returns the previous
  3159. state of the virtual interrupt flag.
  3160.  
  3161. Call With:
  3162.  
  3163.    AX     = 0900H
  3164.  
  3165. Returns:
  3166.  
  3167.    Virtual interrupts disabled
  3168.    Carry flag= clear (this function always succeeds)
  3169.    AL     = 0 if virtual interrupts were previously disabled
  3170.           = 1 if virtual interrupts were previously enabled
  3171.  
  3172. Notes:
  3173.  
  3174. o  AH is not changed by this function.  Therefore, the
  3175.    previous state can be restored by simply executing
  3176.    another Int 31H.  See Int 31H Function 0901H.
  3177.  
  3178. o  A client that does not need to know the prior interrupt
  3179.    state can execute the CLI instruction rather than calling
  3180.    this function.  The instruction may be trapped by the
  3181.    host and should be assumed to  be very slow.
  3182. Int 31H Function 0901H [0.9]
  3183.    
  3184.    
  3185. Get and Enable Virtual Interrupt State
  3186.  
  3187. Enables the virtual interrupt flag and returns the previous
  3188. state of the virtual interrupt flag.
  3189.  
  3190. Call With:
  3191.  
  3192.    AX     = 0901H
  3193.  
  3194. Returns:
  3195.  
  3196.    Virtual interrupts enabled
  3197.    Carry flag= clear (this function always succeeds)
  3198.    AL     = 0 if virtual interrupts were previously disabled
  3199.           = 1 if virtual interrupts were previously enabled
  3200.  
  3201. Notes:
  3202.  
  3203. o  AH is not changed by this function.  Therefore, the
  3204.    previous state can be restored by simply executing
  3205.    another Int 31H.  See Int 31H Function 0900H.
  3206.  
  3207. o  A client that does not need to know the prior interrupt
  3208.    state can execute the STI instruction rather than calling
  3209.    this function.  The instruction may be trapped by the
  3210.    host and should be assumed to  be very slow.
  3211.  
  3212. Int 31H Function 0902H [0.9]
  3213.  
  3214. Get Virtual Interrupt State
  3215.  
  3216. Returns the current state of the virtual interrupt flag.
  3217.  
  3218. Call With:
  3219.  
  3220.    AX     = 0902H
  3221.  
  3222. Returns:
  3223.  
  3224.    Carry flag= clear (this function always succeeds)
  3225.    AL     = 0 if virtual interrupts are disabled
  3226.           = 1 if virtual interrupts are enabled
  3227.  
  3228. Notes:
  3229.  
  3230. o  This function should be used in preference to the PUSHF
  3231.    instruction to examine the interrupt flag, because the
  3232.    PUSHF instruction returns the physical interrupt flag
  3233.    rather than the virtualized (per-client) interrupt flag. 
  3234.    On some DPMI hosts, the physical interrupt flag will
  3235.    always be enabled, even when hardware interrupts are not
  3236.    being passed through to the client.
  3237. Int 31H Function 0A00H [0.9]
  3238.  
  3239. Get Vendor-Specific API Entry Point
  3240.  
  3241. Returns an address which can be called to use host-specific
  3242. extensions to the standard set of DPMI functions.  DPMI 1.0
  3243. clients should avoid use of this function (see Note).
  3244.  
  3245. Call With:
  3246.  
  3247.    AX     = 0A00H
  3248.    DS:(E)SI= selector:offset of ASCIIZ (null-terminated)
  3249.            string which identifies the DPMI host vendor
  3250.  
  3251. Returns:
  3252.  
  3253.    if function successful
  3254.    Carry flag= clear
  3255.    ES:(E)DI= selector:offset of extended API entry point
  3256.  
  3257.    and DS, FS, GS, EAX, EBX, ECX, EDX, ESI, and EBP may be
  3258.            modified.
  3259.    if function unsuccessful
  3260.    Carry flag= set
  3261.    AX     = error code
  3262.            8001H   unsupported function (extension not
  3263.                    found)
  3264.  
  3265. Notes:
  3266.  
  3267. o  The null-terminated string specifies the host-specific
  3268.    vendor name or some other unique identifier to obtain a
  3269.    specific extension entry point.  The string comparison
  3270.    used to look up the API entry point is case-sensitive.
  3271. o  Clients must use a FAR CALL to reach the extended API
  3272.    entry point.
  3273. o  All extended API parameters are specified by the vendor.
  3274. o  DPMI 1.0 clients should use Int 2FH Function 168AH in
  3275.    preference to this function.  DPMI 1.0 hosts support this
  3276.    function solely for backward compatibility with DPMI 0.9
  3277.    clients.
  3278. Int 31H Function 0B00H [0.9]
  3279.  
  3280. Set Debug Watchpoint
  3281.  
  3282. Sets a debug watchpoint at the specified linear address.
  3283.  
  3284. Call With:
  3285.  
  3286.    AX     = 0B00H
  3287.    BX:CX  = linear address of watchpoint
  3288.    DL     = size of watchpoint (1, 2, or 4 bytes)
  3289.    DH     = type of watchpoint
  3290.            0 = execute
  3291.            1 = write
  3292.            2 = read/write
  3293.  
  3294. Returns:
  3295.  
  3296.    if function successful
  3297.    Carry flag= clear
  3298.    BX     = watchpoint handle
  3299.  
  3300.    if function unsuccessful
  3301.    Carry flag= set
  3302.    AX     = error code
  3303.            8016H   too many breakpoints
  3304.            8021H   invalid value (in DL or DH)
  3305.            8025H   invalid linear address (linear address
  3306.                    not mapped or alignment error)
  3307.  
  3308. Notes:
  3309.  
  3310. o  Under DPMI 1.0, the handle will be in the range 0-14. 
  3311.    Under DPMI 0.9, the handle range is not limited.
  3312. o  The watchpoint handle corresponds to the bit number in
  3313.    the Virtual DR6 returned in the exception frame (see Int
  3314.    31H Function 0212H and page 18).
  3315.  
  3316. Int 31H Function 0B01H [0.9]
  3317.  
  3318. Clear Debug Watchpoint
  3319.  
  3320. Clears a debug watchpoint that was previously set using the
  3321. Set Debug Watchpoint function (Int 31H Function 0B00H), and
  3322. releases the watchpoint 
  3323. handle.
  3324.  
  3325. Call With:
  3326.  
  3327.    AX     = 0B01H
  3328.    BX     = watchpoint handle
  3329.  
  3330. Returns:
  3331.  
  3332.    if function successful
  3333.    Carry flag= clear
  3334.  
  3335.    if function unsuccessful
  3336.    Carry flag= set
  3337.    AX     = error code
  3338.            8023H   invalid handle
  3339.  
  3340.  
  3341. Int 31H Function 0B02H [0.9]
  3342.  
  3343. Get State of Debug Watchpoint
  3344.  
  3345. Returns the state of a debug watchpoint that was previously
  3346. set using the Set Debug Watchpoint function (Int 31H
  3347. Function 0B00H).
  3348.  
  3349. Call With:
  3350.  
  3351.    AX     = 0B02H
  3352.    BX     = watchpoint handle
  3353.  
  3354. Returns:
  3355.  
  3356.    if function successful
  3357.    Carry flag= clear
  3358.    AX     = watchpoint status
  3359.            Bit    Significance
  3360.            0      0 = watchpoint has not been encountered
  3361.                   1 = watchpoint has been encountered
  3362.            1-15   reserved
  3363.  
  3364.    if function unsuccessful
  3365.    Carry flag= set
  3366.    AX     = error code
  3367.            8023H   invalid handle
  3368.  
  3369. Notes:
  3370.  
  3371. o  The client can use Int 31H Function 0B03H to clear the
  3372.    watchpoint state without releasing the watchpoint handle.
  3373. Int 31H Function 0B03H [0.9]
  3374.  
  3375. Reset Debug Watchpoint
  3376.  
  3377. Resets the state of a previously defined debug watchpoint;
  3378. i.e. a subsequent call to Int 31H Function 0B02H will
  3379. indicate that the debug watchpoint has not been encountered.
  3380.  
  3381. Call With:
  3382.  
  3383.    AX     = 0B03H
  3384.    BX     = watchpoint handle
  3385.  
  3386. Returns:
  3387.  
  3388.    if function successful
  3389.    Carry flag= clear
  3390.  
  3391.    if function unsuccessful
  3392.    Carry flag= set
  3393.    AX     = error code
  3394.            8023H   invalid handle
  3395.  
  3396.  
  3397. Int 31H Function 0C00H [1.0]
  3398.  
  3399. Install Resident Service Provider Callback
  3400.  
  3401. Protected mode resident service providers (protected mode
  3402. TSRs) can provide services to 16-bit DPMI programs, 32-bit
  3403. DPMI programs, or both.  A resident service provider uses
  3404. this function to request notification from the host whenever
  3405. another DPMI program in the same virtual machine is loaded
  3406. or terminated.
  3407.  
  3408. Call With:
  3409.  
  3410.    AX     = 0C00H
  3411.    ES:(E)DI= selector:offset of 40-byte buffer with the
  3412.            following structure:
  3413.  
  3414.            OffsetLengthContents
  3415.            00H    8Descriptor for 16-bit data segment
  3416.            08H    8Descriptor for 16-bit code segment
  3417.            10H    2Offset of 16-bit callback procedure
  3418.            12H    2Reserved
  3419.            14H    8Descriptor for 32-bit data segment
  3420.            1CH    8Descriptor for 32-bit code segment
  3421.            24H    4Offset of 32-bit callback procedure
  3422.  
  3423. Returns:
  3424.  
  3425.    if function successful
  3426.    Carry flag= clear
  3427.  
  3428.    if function unsuccessful
  3429.    Carry flag= set
  3430.    AX     = error code
  3431.            8021H   invalid value (access rights/type bytes
  3432.                    invalid, or offset outside segment
  3433.                    limits)
  3434.            8025H   invalid linear address (descriptor
  3435.                    references a linear address range outside
  3436.                    that allowed for DPMI clients)
  3437.            8015H   callback unavailable (host unable to
  3438.                    allocate resources for resident handler
  3439.                    initialization callback)
  3440.  
  3441. Notes:
  3442.  
  3443. o  A DPMI client that uses this function declares its intent
  3444.    to provide resident protected mode services.  The client
  3445.    must subsequently terminate and stay resident using Int
  3446.    31H Function 0C01H.  DPMI clients which intend to stay
  3447.    resident only to provide services to real mode programs
  3448.    should not use this function.
  3449. o  The data structure provides room for a data descriptor, a
  3450.    code descriptor, and an offset for both 16-bit and 32-bit
  3451.    protected modes.  The client can conveniently initialize
  3452.    the descriptor fields to valid values by fetching copies
  3453.    of  its current code and data descriptors with Int 31H 
  3454.    Function 000BH.
  3455. o  If only one mode is supported by the resident service
  3456.    provider, then the code descriptor for the unsupported
  3457.    mode should be initialized to zero.
  3458. o  This function is called on the locked protected mode
  3459.    stack.
  3460.  
  3461. o  For further details on programming of resident service
  3462.    providers, see page 41.
  3463. Int 31H Function 0C01H [1.0]
  3464.  
  3465. Terminate and Stay Resident
  3466.  
  3467. A resident service provider uses this function after its
  3468. initialization to terminate execution while leaving its
  3469. protected mode memory (and optionally some real mode memory)
  3470. allocated.
  3471.  
  3472. Call With:
  3473.  
  3474.    AX     = 0C01H
  3475.    BL     = return code
  3476.    DX     = number of paragraphs (16-byte blocks) of DOS
  3477.            memory to reserve
  3478.  
  3479. Returns:
  3480.  
  3481.    Nothing (this call never returns)
  3482.  
  3483. Notes:
  3484.  
  3485. o  This function should only be used by DPMI clients which
  3486.    only provide resident services to other DPMI protected
  3487.    mode clients.  If the objective is only to provide
  3488.    resident services to real mode programs, the client
  3489.    should use the DPMI translation service Int 31H Function
  3490.    0300H to invoke DOS's Int 21H Function 31H directly.
  3491. o  The value in DX only specifies the size of DOS allocated
  3492.    memory to reserve.  Any protected mode memory owned by
  3493.    the program remains allocated unless it is explicitly
  3494.    released before executing this function.  Note that the
  3495.    value in DX must either be 0 or a minimum of 6.  If DX is
  3496.    0, the DPMI host executes a DOS real mode terminate
  3497.    function (Int 21H Function 4CH), and no real mode memory
  3498.    is reserved.  If DX is nonzero, the DPMI host requests
  3499.    the DOS real mode terminate-and-stay-resident function
  3500.    (Int 21H Function 31H).
  3501.  
  3502. o  If the client has not made a prior call to Int 31H
  3503.    Function 0C00H, the client will simply be terminated.
  3504. o  For further details on programming of resident service
  3505.    providers, see page 41.
  3506. Int 31H Function 0D00H [1.0]
  3507.  
  3508. Allocate Shared Memory
  3509.  
  3510. Allocates a memory block that may be shared by DPMI clients.
  3511.  
  3512. Call With:
  3513.  
  3514.    AX     = 0D00H
  3515.    ES:(E)DI= selector:offset of shared memory allocation
  3516.            request structure in the following format:
  3517.  
  3518.            Offset   Length  Contents
  3519.            00H      4       Requested length of shared
  3520.                             memory block (set by client, may
  3521.                             be zero)
  3522.            04H      4       Length actually allocated (set
  3523.            by host)
  3524.            08H      4       Shared memory handle (set by
  3525.            host)
  3526.            0CH      4       Linear address of shared memory
  3527.                             block (set by host)
  3528.            10H      6       offset32:selector of ASCIIZ
  3529.                             (null-terminated ASCII) name for
  3530.                             shared memory block (set by
  3531.                             client)
  3532.            16H      2       Reserved
  3533.            18H      4       Reserved, must be zero
  3534.  
  3535. Returns:
  3536.  
  3537.    if function successful
  3538.    Carry flag= clear
  3539.  
  3540.    and the request structure fields at offsets 04H, 08H, and
  3541.            0CH updated  by host
  3542.    if function unsuccessful
  3543.    Carry flag= set
  3544.    AX     = error code
  3545.            8012H   linear memory unavailable
  3546.            8013H   physical memory unavailable
  3547.            8014H   backing store unavailable
  3548.            8016H   handle unavailable
  3549.            8021H   invalid value (name for the memory block
  3550.                    is too long)
  3551.  
  3552.    and the request structure fields at offsets 04H, 08H and
  3553.                    0CH unmodified by host
  3554.  
  3555. Notes:
  3556.  
  3557. o  For 16-bit programs, the high word of the offset32 for
  3558.    the ASCIIZ name must be zero.
  3559. o  The maximum length of the shared memory block name is 128
  3560.    characters, including the terminal null character.
  3561. o  The linear address provided by the host is guaranteed to
  3562.    be the same for all clients in all virtual machines using
  3563.    a shared memory block.  The client must establish
  3564.    addressability for the block by allocating and
  3565.    initializing a descriptor with separate function calls.
  3566. o  No assumptions should be made about handle values. 
  3567.    Successive allocations of the same shared memory block by
  3568.     the same client may return distinct handles; the client
  3569.    is responsible for tracking and individually deallocating
  3570.    each handle.
  3571. o  The first client that allocates a shared memory block
  3572.    determines its size; the length requested and the length
  3573.    actually allocated will always be equal, if the
  3574.    allocation succeeds at all.  Subsequent allocations by
  3575.    the same or different clients that specify the same or a
  3576.    different size will succeed, but the size of the block
  3577.    will remain unchanged.  The actual size of the block is
  3578.    always returned to the client at offset 4 in the shared
  3579.    memory allocation request structure.
  3580. o  Allocation of zero-length shared memory blocks is
  3581.    explicitly allowed.  The handle of a zero-length block
  3582.    can be used with the serialization functions (Int 31H
  3583.    Functions 0D02H and 0D03H) as a semaphore for
  3584.    inter-client communication.  The linear address that is
  3585.    returned at offset 0CH in the data structure for
  3586.    zero-length blocks is undefined, and any reference to it
  3587.    may produce a page fault.
  3588. o  The first paragraph (16 bytes) of the shared memory block
  3589.    (or the entire shared block, if smaller than 16 bytes)
  3590.    will always be initialized to zero on the first
  3591.    allocation and can be used by clients as an "area
  3592.    initialized" indicator.  For example, a shared memory
  3593.    block might be used by a suite of cooperating client
  3594.    programs to hold a table of static data or a subroutine
  3595.    library.  The first client to allocate the shared memory
  3596.    block can obtain exclusive ownership of the block with
  3597.    Int 31H Function 0D02H, load the necessary data or code
  3598.    into the block from disk, set the first 16 bytes of the
  3599.    block to a nonzero value, and finally release its
  3600.    ownership 
  3601. of the block with Int 31H Function 0D03H.  Other clients that allocate
  3602.    the shared memory block can check the "area initialized"
  3603.    indicator and know that the desired code or data is
  3604.    already present in memory.
  3605. o  Shared memory block allocations and serializations are
  3606.    tracked by the host on a per client basis. All shared
  3607.    memory allocations for a client are freed by the host
  3608.    when the client terminates.
  3609.  
  3610. Int 31H Function 0D01H [1.0]
  3611.  
  3612. Free Shared Memory
  3613.  
  3614. Deallocates a shared memory block.
  3615.  
  3616. Call With:
  3617.  
  3618.    AX     = 0D01H
  3619.    SI:DI  = handle of shared memory block to free
  3620.  
  3621. Returns:
  3622.  
  3623.    if function successful
  3624.    Carry flag= clear
  3625.  
  3626.    if function unsuccessful
  3627.    Carry flag= set
  3628.    AX     = error code
  3629.            8023H   invalid handle
  3630.  
  3631. Notes:
  3632.  
  3633. o  The shared memory handle becomes invalid after the shared
  3634.    memory block is deallocated, and should not be used in
  3635.    any other function call (such as serialization).
  3636. o  The host maintains virtual machine use counts and a
  3637.    global use count for each shared memory block.  A 
  3638.    virtual machine use count is the number of allocation
  3639.    calls (Int 31H Function 0D00H) that have been issued by a
  3640.    particular virtual machine for the shared block, while
  3641.    the global use count corresponds to the number of virtual
  3642.    machines which have access to the block.  When a virtual
  3643.    machine use count reaches zero, the clients in that
  3644.    virtual machine no longer have addressability to the
  3645.    shared memory block; when the global use count reaches
  3646.    zero, the shared memory block is destroyed by the host.
  3647. o  It is the client's responsibility to free any descriptors
  3648.    that it has allocated to map the shared memory block.
  3649. o  Applications should not depend on this function to
  3650.    release a previous successful serialization for the same
  3651.    shared memory block.  Serialization is only released by
  3652.    this function when the virtual machine use count goes to
  3653.    0 (i.e., the client no longer has access to the shared
  3654.    memory block).
  3655. Int 31H Function 0D02H [1.0]
  3656.  
  3657. Serialize on Shared Memory
  3658.  
  3659. Requests serialization of a shared memory block.  Successful
  3660. serialization symbolizes ownership or right of access to a
  3661. block, and can be used by DPMI clients to synchronize the
  3662. inspection or modification of a shared memory block.
  3663.  
  3664. Call With:
  3665.  
  3666.    AX     = 0D02H
  3667.    SI:DI  = shared memory block handle
  3668.    DX     = option flags
  3669.            Bit    Significance
  3670.            0      0 = suspend client until serialization
  3671.            available
  3672.                   1 = return immediately with error if
  3673.            serialization not available
  3674.            1      0 = exclusive serialization requested
  3675.                   1 = shared serialization requested
  3676.            2-15   reserved, must be zero
  3677.  
  3678. Returns:
  3679.  
  3680.    if function successful
  3681.    Carry flag= clear
  3682.  
  3683.    if function unsuccessful
  3684.    Carry flag= set
  3685.    AX     = error code
  3686.            8004H   deadlock (host detected a deadlock
  3687.                    situation)
  3688.            8005H   request cancelled with Int 31H Function
  3689.                    0D03H
  3690.            8017H   lock count exceeded
  3691.            8018H   exclusive serialization already owned by
  3692.                    another client
  3693.            8019H   shared serialization already owned by
  3694.                    another client
  3695.            8023H   invalid handle
  3696.  
  3697. Notes:
  3698.  
  3699. o  For each client, the DPMI host maintains four different
  3700.    local (virtual machine) serialization counts (exclusive,
  3701.    shared, pending shared, and pending exclusive) for each
  3702.    shared memory block, as well as a global serialization
  3703.    count.  The global serialization count is only updated
  3704.    when the sum of a virtual machine's exclusive and shared
  3705.    serialization counts goes from 0 to 1 (serialize) or 1 to
  3706.    0 (free).
  3707. o  A successful exclusive serialization blocks any
  3708.    serialization request (exclusive or shared) for the same
  3709.    block by another virtual machine.   Exclusive
  3710.    serialization should be regarded as "ownership for
  3711.    writing," and should only be requested if the client
  3712.    intends to modify the block.  A successful shared
  3713.    serialization will only block requests for exclusive
  3714.    serialization by another client.  Shared serialization
  3715.    can be thought of as "read-only access," and should used
  3716.    when the client only intends to inspect the block and
  3717.    will not change its contents.
  3718. o  Setting bit 0 of DX to 1 when the serialization request
  3719.    is made allows a client to determine whether a shared
  3720.    memory area is serialized without being suspended. 
  3721.    Clients which "poll" for the availability of a resource
  3722.    in this manner are encouraged to yield the CPU with Int
  3723.    2FH Function 1680H at appropriate intervals.
  3724. o  A serialization call that causes a client to be suspended
  3725.    can be canceled by a client interrupt service routine
  3726.    (such as a keyboard or timer interrupt handler)
  3727.    requesting the Free Serialization function (Int 31H
  3728.    Function 0D03H).  In such cases, the original
  3729.    serialization request will return with the Carry flag set
  3730.    and AX = 8005H.
  3731. o  A client that has been suspended while waiting for
  3732.    serialization of a shared memory block can still service
  3733.    interrupts.  Some hosts may need to reissue the
  3734.    serialization request on behalf of the client after the
  3735.    interrupt service routine returns, but this event will be
  3736.    invisible to the client.
  3737. o  Hosts are not required to detect deadlock.  Clients that
  3738.    terminate and stay resident in order to function as
  3739.    resident service providers, executing in the context of
  3740.    other clients, must be careful to avoid deadlocks and
  3741.    incorrect sequencing in acquiring and releasing
  3742.    resources.
  3743. Int 31H Function 0D03H [1.0]
  3744.  
  3745. Free Serialization on Shared Memory
  3746.  
  3747. Releases a shared memory block serialization that was
  3748. previously obtained with Int 31H Function 0D02H.
  3749.  
  3750. Call With:
  3751.  
  3752.    AX     = 0D03H
  3753.    SI:DI  = shared memory block handle
  3754.    DX     = option flags
  3755.            Bit    Significance
  3756.            0      0 = release exclusive serialization
  3757.                   1 = release shared serialization
  3758.            1      0 = don't free pending serialization
  3759.                   1 = free pending serialization (see Note)
  3760.            2-15   reserved, must be zero
  3761.  
  3762. Returns:
  3763.  
  3764.    if function successful
  3765.    Carry flag= clear
  3766.  
  3767.    if function unsuccessful
  3768.    Carry flag= set
  3769.    AX     = error code
  3770.            8002H   invalid state (client does not own a
  3771.                    successful serialization of the specified
  3772.                    type)
  3773.            8023H   invalid handle
  3774.  
  3775. Notes:
  3776.  
  3777. o  For each client, the DPMI host maintains four different
  3778.    local (virtual machine) serialization counts (exclusive,
  3779.    shared, pending shared, and pending exclusive) for each
  3780.    shared memory block, as well as a global serialization
  3781.    count.  The global serialization count is only updated
  3782.    when the sum of a virtual machine's exclusive and shared
  3783.    serialization counts goes from 0 to 1 (serialize) or 1 to
  3784.    0 (free).
  3785. o  A client's interrupt handler can call this function with
  3786.    bit 1 of DX set to cancel a serialization request that
  3787.    has suspended the main thread of execution of the same
  3788.    client.  In such cases, the original serialization
  3789.    request will return with the Carry flag set and AX =
  3790.    8005H.
  3791. Int 31H Function 0E00H [1.0]
  3792.  
  3793. Get Coprocessor Status
  3794.  
  3795. Returns information about whether or not a numeric
  3796. coprocessor exists, the type of coprocessor available (if
  3797. any), and whether or not the host or client is providing
  3798. coprocessor emulation.
  3799.  
  3800. Call With:
  3801.  
  3802.    AX     = 0E00H
  3803.  
  3804. Returns:
  3805.  
  3806.    if function successful
  3807.    Carry flag= clear (this function always succeeds in DPMI
  3808.            1.0)
  3809.    AX     = coprocessor status
  3810.  
  3811.            Bit    Significance
  3812.            0      MPv (MP bit in the virtual MSW/CR0)
  3813.                   0 = numeric coprocessor is disabled for
  3814.            this client
  3815.                   1 = numeric coprocessor is enabled for
  3816.            this client
  3817.            1      EMv (EM bit in the virtual MSW/CR0)
  3818.                   0 = client is not emulating coprocessor
  3819.            instructions
  3820.                   1 = client is emulating coprocessor
  3821.            instructions
  3822.            2      MPr (MP bit from the actual MSW/CR0)
  3823.                   0 = numeric coprocessor is not present
  3824.                   1 = numeric coprocessor is present
  3825.            3      EMr (EM bit from the actual MSW/CR0)
  3826.                   0 = host is not emulating coprocessor
  3827.            instructions
  3828.                   1 = host is emulating coprocessor
  3829.            instructions
  3830.            4-7    coprocessor type
  3831.                   00H = no coprocessor
  3832.                   02H = 80287
  3833.                   03H = 80387
  3834.                   04H = 80486 with numeric coprocessor
  3835.                           05H-0FH  reserved for future
  3836.            numeric processors
  3837.            8-15   not applicable
  3838.  
  3839.  
  3840.    if function unsuccessful
  3841.    Carry flag= set (this function always fails in DPMI 0.9)
  3842.  
  3843. Notes:
  3844.  
  3845. o  If the real EM (EMr) bit is set, the host is supplying or
  3846.    is capable of supplying floating point emulation.
  3847. o  If the MPv bit is not set, the host may not need to save
  3848.    the coprocessor state for this virtual machine to improve
  3849.    system performance.
  3850. o  MPr bit setting should be consistent with the setting of
  3851.    coprocessor type information. Ignore MPr bit information
  3852.    if it is in conflict with the coprocessor type 
  3853.    information.
  3854. o  If the virtual EM (EMv) bit i
  3855. s set, the host delivers all coprocessor exceptions to the client, and
  3856.    the client is performing its own floating point emulation
  3857.    (whether or not a coprocessor is present or the host also
  3858.    has a floating point emulator).  In other words, if the
  3859.    EMv bit is set, the host sets the EM bit in the real CR0
  3860.    while the virtual machine is active, and reflects
  3861.    coprocessor not present faults (Int 7) to the virtual
  3862.    machine.
  3863. o  A client can determine the CPU type with Int 31H Function
  3864.    0400H, but a client should not draw any conclusions about
  3865.    the presence or absence of a coprocessor based on the CPU
  3866.    type alone.
  3867. Int 31H Function 0E01H [1.0]
  3868.  
  3869. Set Coprocessor Emulation
  3870.  
  3871. Enables or disables the numeric coprocessor for this virtual
  3872. machine  and the reflection of coprocessor exceptions to the
  3873. client.
  3874.  
  3875. Call With:
  3876.  
  3877.    AX     = 0E01H
  3878.    BX     = coprocessor bits
  3879.  
  3880.            Bit    Significance
  3881.            0      new value of MPv bit for client's virtual
  3882.            CR0
  3883.                   0 = disable numeric coprocessor for this
  3884.            client
  3885.                   1 = enable numeric coprocessor for this
  3886.            client
  3887.            1      new value of EMv bit for client's virtual
  3888.            CR0
  3889.                   0 = client will not supply coprocessor
  3890.            emulation
  3891.                   1 = client will supply coprocessor
  3892.            emulation
  3893.            2-15   not applicable
  3894.  
  3895.  
  3896. Returns:
  3897.  
  3898.    if function successful
  3899.    Carry flag= clear
  3900.  
  3901.    if function unsuccessful
  3902.    Carry flag= set
  3903.    AX     = error code
  3904.            8026H   invalid request (client requested
  3905.                    disabling coprocessor on a processor
  3906.                    which does not support this)
  3907.  
  3908. Notes:
  3909.  
  3910. o  If the MPv bit is not set, the host may not need to save
  3911.    the coprocessor state for this virtual machine to improve
  3912.    system performance.
  3913. o  If the virtual EM (EMv) bit is set, the host delivers all
  3914.    coprocessor exceptions to the client, so that the client
  3915.    can provide its own floating point emulation (whether or
  3916.    not a coprocessor is present or the host also has a
  3917.    floating point emulator).  In other words, if the EMv bit
  3918.    is set, the host sets the EM bit in the real CR0 while
  3919.    the client is active, and reflects coprocessor not
  3920.    present faults (Int 7) to the client.
  3921. o  Floating point emulation can be tested on a system with a
  3922.    numeric coprocessor by using this function to enable
  3923.    client handling of coprocessor exceptions and disable the
  3924.    coprocessor.
  3925. o  The client should use Int 31H Function 0212H to register
  3926.    an exception handler for coprocessor not present faults
  3927.    (Int 7) prior to setting the EMv bit with this function.
  3928. o  A client can determine the CPU type with Int 31H Function
  3929.    0400H, and the presence or absence of a coprocessor with 
  3930.    Int 31H Function 0E00H.  The client should not draw any
  3931.    conclusions about the presence or absence of a
  3932.    coprocessor based on the CPU type alone.
  3933.  
  3934. Appendix B:  Error Codes and Messages
  3935.  
  3936.  
  3937.  
  3938. Nearly all Int 31H function calls can fail, either because
  3939. of client errors, unavailable resources, or internal host
  3940. problems.  Most failures due to client errors and all
  3941. failures due to unavailable resources are reported to the
  3942. client via error codes.  Some client errors, such as passing
  3943. an invalid pointer in a function call, may cause the host to
  3944. fault; the client can detect these events by installing an
  3945. exception handler. 
  3946. Internal host errors are handled in a host-specific manner 
  3947. and generally not reported to clients with an error code.
  3948. The only exception to this is the case when a host cannot
  3949. allocate internal resources. Any Int 31H function is capable
  3950. of returning error code 8010H to indicate this condition.
  3951. A DPMI 1.0 host signals an error by returning from a
  3952. function with the Carry flag set and an error code in AX.  
  3953. If the error code has bit 15 clear (0), the DPMI host is
  3954. passing a DOS error code through to the client; for a list
  3955. of these error codes, consult a DOS technical reference.  If
  3956. the error code has bit 15 set (1), it is generated within
  3957. the DPMI host, and is interpreted according to the list
  3958. below.  All DPMI 1.0 hosts are required to check for the
  3959. error conditions listed in this specification, and must
  3960. return the error codes that are documented for each
  3961. function.
  3962. If Int 31H is invoked with an function number that is not
  3963. defined in this specification, the DPMI host will return the
  3964. "Unsupported Function" error code 8001H. The table lists all
  3965. defined error codes and their messages. Unused error codes
  3966. are reserved for the later versions of the DPMI
  3967. spcifications.
  3968.  
  3969. Err
  3970. or
  3971. Cod
  3972. e Name Explanation 800
  3973. 1H Unsupported
  3974. function Returned in response to
  3975. any function call which is
  3976. not implemented by this
  3977. host, because the
  3978. requested function is
  3979. either undefined or
  3980. optional. 800
  3981. 2H Invalid state Some object is in the
  3982. wrong state for the
  3983. requested operation. 800
  3984. 3H System integrity The requested operation
  3985. would endanger system
  3986. integrity, e.g., a request
  3987. to map linear addresses
  3988. onto system code or data. 800
  3989. 4H Deadlock Host detected a deadlock
  3990. situation. 800
  3991. 5H Request
  3992. cancelled A pending serialization
  3993. request was cancelled. 801
  3994. 0H Resource
  3995. Unavailable The DPMI host cannot
  3996. allocate internal
  3997. resources to complete an
  3998. operation. 801
  3999. 1H Descriptor
  4000. unavailable Host is unable to allocate
  4001. a descriptor. 801
  4002. 2H Linear memory
  4003. unavailable Host is unable to allocate
  4004. the required linear
  4005. memory. 801
  4006. 3H Physical memory
  4007. unavailable Host is unable to allocate
  4008. the required physical
  4009. memory. 801
  4010. 4H Backing store
  4011. unavailable Host is unable to allocate
  4012. the required backing
  4013. store. 801
  4014. 5H Callback
  4015. unavailable Host is unable to allocate
  4016. the required callback
  4017. address. 801
  4018. 6H Handle
  4019. unavailable Host is unable to allocate
  4020. the required handle. 801
  4021. 7H Lock count
  4022. exceeded A locking operation
  4023. exceeds the maximum count
  4024. maintained by the host. 801
  4025. 8H Resource owned
  4026. exclusively A request for
  4027. serialization of a shared
  4028. memory block could not be
  4029. satisfied because it is
  4030. already serialized
  4031. exclusively by another
  4032. client. 801
  4033. 9H Resource owned
  4034. shared A request for exclusive
  4035. serialization of a shared
  4036. memory block could not be
  4037. satisfied because it is
  4038. already serialized shared
  4039. by another client. 802
  4040. 1H Invalid value A numeric or flag
  4041. parameter has an invalid
  4042. value. 802
  4043. 2H Invalid selector A selector does not
  4044. correspond to a valid
  4045. descriptor. 802
  4046. 3H Invalid handle A handle parameter is
  4047. invalid. 802
  4048. 4H Invalid callback A callback parameter is
  4049. invalid. 802
  4050. 5H Invalid linear
  4051. address A linear address range
  4052. (either supplied as a
  4053. parameter or implied by
  4054. the call) is invalid. 802
  4055. 6H Invalid request The request is not
  4056. supported by the
  4057. underlying hardware.
  4058.