_Allocate_GDT_Selector

include vmm.inc

VMMCall _Allocate_GDT_Selector, <DescDWORD1, DescDWORD2, flags>

mov     ecx, eax                    ; zero in eax and edx if error
or      ecx, edx
jz      error

mov     [Selector], eax             ; new selector
mov     word ptr [GDTSel], dx       ; selector for the GDT
ror     edx, 10h
mov     word ptr [SelCount], dx     ; number of selectors in GDT

Creates a new selector and adds it to the Global Descriptor Table (GDT). Uses EAX, ECX, EDX, and Flags.

Register Description
EAX Contains the new selector.
EDX Contains the selector for and the size of the GDT. The low 16 bits contains the selector for the GDT, and the high 16 bits contains the size of the GDT expressed as the number of selectors in the table.

The service returns zero in both registers if an error occurs.

DescDWORD1
High-order doubleword of the segment descriptor. This parameter contains the high 16 bits of the base address, the high 4 bits of the limit, and the status and type bits.
DescDWORD2
Low-order doubleword of the segment descriptor. This parameter contains the low 16 bits of the base address and limit.
flags
Operation flags. Must be 0.

Although this service returns the selector for the GDT, virtual devices should not attempt to edit the GDT directly. Virtual devices can instead use the _SetDescriptor service to change selectors in the GDT.

Virtual devices should use the _BuildDescriptorDWORDs service to set the DescDWORD1 and DescDWORD2 parameters to the appropriate values.

This service sets the RPL of the selector to the DPL of the selector set in the DescDWORD1 parameter.

See Also

_Allocate_LDT_Selector, _Free_GDT_Selector