include vmm.inc VMMcall _HeapReAllocate, <hAddress, nbytes, flags> or eax, eax ; zero if error jz error mov [Address], eax ; address of reallocated block |
The _HeapReAllocate service reallocates or reinitializes an existing memory block.
hAddress
Specifies the address of the memory block. This address must have been previously returned from the _HeapAllocate or _HeapReAllocate service.
nbytes
Specifies the new size in bytes of the reallocated block. This parameter must not be zero.
flags
Specifies the allocation flags. This parameter can be a combination of the following values:
Value | Meaning |
HeapNoCopy | Does not preserve contents of existing bytes. If this value is not given, the service preserves the contents of existing bytes by copying the contents of the old memory block into the new block. |
HeapZeroInit | Fills any new bytes in the memory block with zeros. All existing bytes remain unchanged. |
HeapZeroReInit | Fills all bytes, new and existing, with zeros. |
All other values are reserved.
The EAX register contains the ring-0 address of the new block if the service is successful. Otherwise, EAX contains zero to indicate an error, such as insufficient memory, to satisfy the request or an invalid address.
If this service is successful, it frees the old memory block, making the old address invalid. Virtual devices must never rely on the old and new addresses being the same. If this service returns an error, the old memory block is not freed and the old address remains valid.
Since the system offers no protection on the heap, virtual devices must provide their own protection to prevent overrunning allocated blocks.
The system offers no compaction on the heap; all memory blocks on the heap are fixed. Virtual devices must not not to use the heap in such a way as to severely fragment it.
EAX