Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- XMS Specification (version 3.0) - <b>implementation notes for dos xms drivers</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
IMPLEMENTATION NOTES FOR DOS XMS DRIVERS

    A DOS XMS driver's control function must begin with code similar to
    the following:

XMMControl  proc    far

            jmp     short XCControlEntry     ; For "hookability"
            nop                              ; NOTE: The jump must be a short
            nop                              ;  jump to indicate the end of
            nop                              ;  any hook chainThe nop's
                                             ;  allow a far jump to be
                                             ;  patched in.
XCControlEntry:


    XMS drivers must preserve all registers except those containing
    returned values across any function call.

    XMS drivers are required to hook INT 15h and watch for calls to
    functions 87h (Block Move) and 88h (Extended Memory Available). The
    INT 15h Block Move function must be hooked so that the state of the
    A20 line is preserved across the call. The INT 15h Extended Memory
    Available function must be hooked to return 0h to protect the HMA.

    In order to maintain compatibility with existing device drivers, DOS
    XMS drivers must not hook INT 15h until the first non-Version Number
    call to the control function is made.

    XMS drivers are required to check for the presence of drivers which
    use the IBM VDISK allocation scheme.  Note that it is not sufficient
    to check for VDISK users at installation time but at the time when
    the HMA is first allocated.  If a VDISK user is detected, the HMA
    must not be allocated. Microsoft will publish a standard method for
    detecting drivers which use the VDISK allocation scheme.

    XMS drivers which have a fixed number of extended memory handles
    (most do) should implement a command line parameter for adjusting
    that number (suggested name "/NUMHANDLES=")

    XMS drivers should make sure that the major DOS version number is
    greater than or equal to 3 before installing themselves.

    UMBs cannot occupy memory addresses that can be banked by EMS
    4.0.EMS 4.0 takes precedence over UMBs for physically addressable
    memory.

    All driver functions must be re-entrant.  Care should be taken to
    not leave interrupts disabled for long periods of time.

    Allocation of a zero length extended memory buffer is allowed.
    Programs which hook XMS drivers may need to reserve a handle for
    private use via this method.  Programs which hook an XMS driver
    should pass all requests for zero length EMBs to the next driver in
    the chain.

    Drivers should control the A20 line via an "enable count." Local
    Enable only enables the A20 line if the count is zero.  It then
    increments the count. Local Disable only disables A20 if the count
    is one.  It then decrements the count. Global Enable/Disable keeps a
    flag which indicates the state of A20.  They use Local
    Enable/Disable to actually change the state.

    Drivers should always check the physical A20 state in the local
    Enable-Disable calls, to see that the physical state matches the
    internal count.  If the physical state does not match, it should be
    modified so that it matches the internal count.  This avoids
    problems with applications that modify A20 directly.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson