XMS Functions

The following is a brief summary of LIMA XMA functions. This is a summary of the specification itself, and not of its implementation in OS/2 Version 2.0.

Determining XMS Presence

Calling interrupt 2Fh with AH=43h and AL=00h will return AL=80h if an XMS driver is installed. Calling interrupt 2Fh with AH=43h and AL=10h will return the far entry point address of the XMS control function in ES:BX. The control function must be called as a far procedure.

Requesting/Releasing HMA

There is only one 64KB HMA and it cannot be divided. An application which requests the HMA is given the entire HMA, even if it uses only part of it. When an application has successfully requested the HMA, it is guaranteed sole access to it until it is released. As part of the request, the application indicates how much of the HMA it expects to use. If this value does not exceed a user-specified threshhold, the request is denied. This test is performed so that the HMA is given only to applications which make substantial use of the HMA.

A20 Address Line Control

Two pairs of functions are used to control the status of the A20 address line. The application may control the A20 address line either globally or locally. Global control is used by programs which have control of the HMA. Local control is used by programs which need to access extended memory directly. Global settings are kept in a simple on/off flag, whereas local control uses a counter. Hence, the number of "local disable" calls must equal the number of "local enable" calls before the A20 line is actually disabled, whereas a single "global disable" call suffices to disable the A20 address line, regardless of how many "global enable" calls have been made.

Allocating/Reallocating/Deallocating Extended Memory Blocks

An allocation request can be made for a particular-sized EMB (in kilobyte units) and, if successful, an EMB handle is returned. This handle is used to reallocate, lock, unlock, or deallocate memory. It is also used to move memory between the EMB and conventional memory or other EMBs. An EMB may be locked and while locked, it may not be reallocated or deallocated, nor may its base address change.

Allocating/Deallocating Upper Memory Blocks

An allocation request can be made for a particular-sized UMB (in paragraph units) and, if successful, the segment number of the UMB is returned, as well as the actual size of the UMB. This segment number is also used to deallocate the UMB. UMBs may not be resized.

Information Calls

The application can obtain information about the XMS memory resources available and handle usage. In a multiprogramming environment or where TSRs are loaded, this information may be out of date before being used. For instance, an application may determine the amount of XMS memory available, but before getting the opportunity to request an allocation, a TSR may request XMS memory. The application would find less memory available than expected.

Data Movement

A move or copy function provides data movement between any combination of conventional or extended memory. The memory being affected need not be locked. The start of a region of extended memory is indicated by handle and offset. Overlapping copies will succeed provided the source address is below the destination address. Moreover, blocks being moved must be of even length; word alignment is not required, however. This function is the only method of accessing an extended memory block without leaving real mode.


[Back: XMS Overview]
[Next: Multiple Virtual DOS Machines Lab Sessions]