_PageUnLock

include vmm.inc

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

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

jz not_unlocked


The _PageUnLock service unlocks one or more pages in the specified memory block.

Parameters

hMem

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

nPages

Specifies the number of pages to unlock.

PageOff

Specifies the offset in pages from the start of the block, to the first page to unlock.

flags

Specifies the operation flags. This parameter can be a combination of the following values:

Value Meaning

PageLockedIfDP Unlocks pages only if the virtual page swap device use MS-DOS or BIOS functions to write to the hardware. If the virtual page swap device writes directly to the hardware, this service returns immediately without unlocking the pages.
  The PageLockedIfDP value cannot be used until after the Init_Complete message has been processed.
PageMarkPageOut Marks pages for immediate swapping, if this service sets the lock count for the pages to zero. This service marks the pages by clearing the P_ACC bit for each page. The PageMarkPageOut value should only be used if the pages are unlikely to be accessed for some time.

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.

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. It also returns an error if the specified pages are not already 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

_PageLock