_PageLock

include vmm.inc

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

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

jz not_locked


The _PageLock service locks one or more pages in the specified memory block.

Parameters

hMem

Specifies a handle identifying the memory block to lock. This handle must have been previously created using the _PageAllocate or _PageReAllocate service.

nPages

Specifies the number of pages to lock.

PageOff

Specifies the offset (in pages) from the start of the memory block to the first page to lock.

flags

Specifies the operation flags. This parameter can be the following value:

Value Meaning

PageLockedIfDP Locks pages only if the virtual page swap device uses MS-DOS or BIOS function to write pages to the hardware. If the virtual page swap device writes directly to the hardware, this service returns immediately without locking the pages.
  The PageLockedIfDP value cannot be used until after the Init_Complete message has been processed.

All other values are reserved.

Return Value

The EAX register contains a nonzero value if the service is successful. Otherwise, EAX contains zero to indicate an error, such as an invalid memory handle or insufficient memory.

Comments

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 affect 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.

Uses

EAX

See Also

_PageAllocate, _PageUnLock