_PageLock


include vmm.inc

VMMcall _PageLock, <hMem, nPages, PageOff, flags>

or      eax, eax        ; nonzero if locked, zero if error
jz      not_locked

Locks one or more pages in the specified memory block. Uses EAX, ECX, EDX, and Flags.

hMem

Handle (base linear address) of the memory block that contains the pages to lock. This value have been previously returned by the _PageAllocate, _PageReAllocate, or _PageReserve service.

nPages

Number of pages to lock.

PageOff

Offset in pages from the start of the memory block to the first page to lock.

flags

Operation flags. Can be zero or the PAGELOCKEDIFDP value. All other values are reserved.

If the PAGELOCKEDIFDP value is specified, pages are locked only if the virtual swap device uses MS-DOS or BIOS functions to write pages to the hardware. The PAGELOCKEDIFDP value cannot be used until after the Init_Complete message has been processed.

The _LinPageLock service is the preferred method of locking pages.

This service returns an error if the sum of the PageOff and nPages parameters is greater than the number of pages in the memory block.

This service has no effect on memory blocks allocated using the PAGEFIXED value; such memory is always locked.

Virtual devices must not assume that the requested number of pages can always be locked.

Each page in a memory block has an individual lock count. This service increments the lock count each time the page is locked, and decrements the count each time the page is unlocked. The lock count must be zero for the page to be unlocked. This means that if the handle is locked 5 times, it has to be unlocked 5 times. Virtual devices must not leave handles locked when not needed.

See also _PageAllocate, _PageUnLock