System32 Function 08 (08h) - Request Selector

Description
Will allocate a selector in the GDT(Global Descriptor Table). While the V2_OS is flexible enough to let applications add descriptors to the GDT themselves, and reload the GDT, it is recommended to use this Service. This way V2_OS can remove descriptors from an application that crashes or gets terminated for any other reason.
Input

AL

8h

EDI

Absolute base address of the memoryblock this descriptor should refer to.

EBX

Amount of bytes of the memoryblock this descriptor should refer to.

DL

0 for a DataDescriptor
1 for a CodeDescriptor

DH

0 for a 16Bit Descriptor
1 for a 32Bit Descriptor
Output

AX

The allocated selector(AX?!)
Errorcodes

None

Notes
*Allocating a descriptor does NOT mean that the memory range is being protected against allocation by other codemodules !
*The presence of the 'G' Bit in the descriptor is decided by System32 based on the value in EBX.
*All Descriptors are (ofcourse) initialized with DPL(Descriptor Privilege Level) 0
Development Status
Works, but needs fine-tuning...
*Should give error when GDT is full(Don't expect it to happen to a 0xFFFFh Byte GDT though...)
*That AX register in the 'Output field', was that correct ?!

Back