Mark Real Mode Region as Pageable


Under some implementations of DPMI, all memory in
virtual 8086 mode is locked by default. If a protected
mode program is using memory in the first megabyte of
address space, it is a good idea to use this function
to turn off automatic page locking for regions of
memory that will not be touched at interrupt time.

Do not mark memory as pageable in regions that are not
owned by your application. For example, you should not
mark all free DOS memory as pageable since it may cause
a page fault to occur while inside of DOS (causing a
crash). Also, do not mark the DPMI host data area as
pageable.

It is very important to relock any real mode memory
using function 0603h before terminating a program.
Memory that remains unlocked after a program has
terminated could result in fatal page faults when other
software is executed in that address space.

Note that address space marked as pageable by this
function can be locked using function 0600h. This
function is just an advisory service to allow memory
that does not need to be locked to be paged out. This
function just disables any automatic locking of real
mode memory performed by the DPMI host.

To Call

AX = 0602h
BX:CX = Starting linear address of memory to mark as
pageable
SI:DI = Size of region to page in bytes

Returns

If function was successful:
Carry flag is clear.

If function was not successful:
Carry flag is set.

Programmer's Notes

o If this function fails then none of the memory
will be unlocked.
o If the specified region overlaps part of a page at
the beginning or end of the region, the page(s)
will be not be marked as pageable.
o When your program terminates it should call
function 0603h to relock the memory region.
o Unlike the lock and unlock calls, the pageability
of the real mode region is maintained as a binary
state, not a count. Therefore, do not call this
function multiple times for a given linear region.