include vmm.inc VMMcall _HeapAllocate, <nbytes, flags> or eax, eax ; zero if error jz not_allocated mov [Address], eax ; address of memory block |
The _HeapAllocate service allocates a block of memory from the heap.
nbytes
Specifies the size in bytes of the block to allocate. This parameter must not be zero.
flags
Specifies the allocation flags. It can be the following value:
Value | Meaning |
HeapZeroInit | Fills the memory block with zeros. If this value is not given, the initial content of the memory block is undefined. |
All other values are reserved.
The EAX register contains the ring-0 address of the block if the service is successful. Otherwise, EAX contains zero to indicate an error such as insufficient memory to satisfy the request.
This service aligns allocated block on doubleword boundaries, however, the block size does not have to be a multiple of 4.
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 to use the heap in such a way as to severely fragment it.
EAX