These services are only useful under DPMI implementations that support virtual memory. They will be ignored by 16-bit DPMI implementations (although they will always return with carry clear to indicate success).
Some implementations of DPMI may ignore these calls. However, if the calls are ignored then the DPMI host will be able to handle page faults at arbitrary points during the application's execution including interrupt and exception handler code.
Although memory ranges are specified in bytes, the actual unit of memory that will be locked will be one or more pages. Page locks are maintained as a count. When the count is decremented to zero, the page is unlocked and can be swapped to disk. This means that if a region of memory is locked three times then it must be unlocked three times before the pages will be unlocked.
This function locks a specified linear address range.
To Call
AX = 0600h
BX:CX = Starting linear address of memory to lock
SI:DI = Size of region to lock in bytes
Returns
If function was successful:
Carry flag is clear.
If function was not successful:
Carry flag is set.
Programmer's Notes
This function unlocks a specified linear address range that was previously locked using the Lock Linear Region function.
To Call
AX = 0601h
BX:CX = Starting linear address of memory to unlock
SI:DI = Size of region to unlock in bytes
Returns
If function was successful:
Carry flag is clear.
If function was not successful:
Carry flag is set.
Programmer's Notes
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
This function is used to relock memory regions that were marked as pageable by the previous function.
To Call
AX = 0603h
BX:CX = Starting linear address of memory to relock
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
This function returns the size of a single memory page in bytes.
To Call
AX = 0604h
Returns
If function was successful:
Carry flag is clear
BX:CX = Page size in bytes
If function was not successful:
Carry flag is set
Programmer's Notes
None.