List_Create

include vmm.inc

mov eax, Flags ; creation flags

mov ecx, NodeSize ; size in bytes of each node in list

VMMcall List_Create

jc error ; carry flag set if error

mov [List], eax ; list handle


The List_Create service creates a new list structure and returns a list handle that virtual devices use in subsequent calls to other list services.

Parameters

Flags

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

Value Meaning

LF_Alloc_Error Directs the List_Allocate service to returns with carry flag set if new node could not be allocated.
LF_Async Creates an asynchronous list that can be used while processing interrupts.
LF_Use_Heap Allocates nodes on the system heap. This value must not be used in combination with the LF_Async value.

NodeSize

Specifies the size (in bytes) of each node in the list.

Return Value

If carry flag is clear, the ESI register contains the list handle. The carry flag is set to indicate an error.

Comments

If a virtual device requires large nodes, it should specify the LF_Use_Heap value to force the nodes to be allocated from the system heap. All allocate and deallocate calls for lists created in this way use the _HeapAlloc and _HeapFree services to create and destroy nodes.

To access a list during hardware interrupts, a virtual device must set the LF_Async value when creating the list. This forces list operations to be atomic operations which cannot be re-entered. When using an asynchronous list, the virtual device must disable interrupts before calling the list services. The virtual device must disable interrupts even if when not calling during an interrupt. The virtual device must use the pushf, cli, and popf instructions to disable and re-enable interrupts. It must not use the sti instruction to enable interrupts unless other documentation states that this is premitted.

If the LF_Alloc_Error value is not specified, the system crashes the current virtual machine if the List_Allocate service fails. If this value is specified, List_Allocate returns with the carry flag set when an allocation fails.

Uses

ESI, Flags

See Also

List_Allocate, List_Deallocate, List_Destroy