include vmm.inc VMMcall _PageReAllocate, <hMem, nPages, flags> mov ecx, eax ; zero in eax and edx if error or ecx, edx jz error mov [Handle], eax ; memory handle mov [Address], edx ; physical address of start of memory block |
The _PageReAllocate service reallocates and optionally reinitializes an existing memory block. The service can increase or decrease the number of pages in the memory block.
hMem
Specifies a handle identifying the memory block to reallocate. This handle must have been previously created using the _PageAllocate or _PageReAllocate service.
nPages
Specifies the number of pages in the reallocated memory block. This parameter must not be set to zero. To free a memory block, use the _PageFree service.
flags
Specifies the operation flags. This parameter can be a combination of the following values:
Value | Meaning |
PageLocked | Locks the allocated pages in the memory. The pages can be subsequently unlocked using the _PageUnLock service. The service locks the memory block regardless of the type of virtual page swap device present. |
PageLockedIfDP | Locks the allocated pages in memory only if the virtual page swap device uses MS-DOS or BIOS functions to write to the hardware. If the pages are locked, they can be subsequently unlocked using the _PageUnLock service. |
A virtual device must not specify the PageLockedIfDP value until after the Init_Complete message has been processed by all virtual devices. | |
PageNoCopy | Does not preserve contents of existing pages. If this value is not given, the service preserves the contents of each existing page by copying the contents of the old memory block into the corresponding pages of the new block. |
PageZeroInit | Fills any new pages with zeros. All existing pages remain unchanged. |
PageZeroReInit | Fills all pages, new and existing, with zeros. |
All other values are reserved.
The EAX register contains the memory handle of the new memory block, and the EDX register contains the ring-0 linear address of the block. Otherwise, the EAX and EDX registers both contain zero to indicate an error such as insufficient memory, an invalid memory handle, or wrong memory type.
If successful, this service frees the old memory block, making the old memory handle and starting address invalid. If this service returns an error, the old memory handle and starting address remain valid.
If the specified memory handle identifies a fixed memory block (allocated using the PageFixed value), this service implicitly allocates fixed pages for the new memory block.
If the specified handle identifies an aligned memory block (allocated using the PageUseAlign value), this service returns an error.
Virtual devices must never rely on the new and old memory handles being the same, or the new and old starting addresses being equal.
The action specified by the PageLockedIfDP value is available only after the virtual page swap device has been initialized.
EAX, EDX