StuBS
GDT Namespace Reference

Abstracts the GDT that, primarily, contains descriptors to memory segments. More...

Classes

union  SegmentDescriptor
 Describes the structure of segment descriptors. More...
 
struct  Pointer
 Structure that describes a GDT Pointer (aka GDT Descriptor) More...
 

Enumerations

enum  Granularity { GRANULARITY_BYTES = 0 , GRANULARITY_4KBLOCK = 1 }
 Unit of the segment limit. More...
 
enum  DescriptorType { DESCRIPTOR_SYSTEM = 0 , DESCRIPTOR_CODEDATA = 1 }
 Descriptor type. More...
 
enum  Size { SIZE_16BIT = 0 , SIZE_32BIT = 2 }
 Address width. More...
 
enum  Gate { }
 gate type More...
 

Detailed Description

Abstracts the GDT that, primarily, contains descriptors to memory segments.

The GDT is a table that primarily contains segment descriptors. Segment descriptors has a size of 8 Bytes and contains the size, position, access rights, and purpose of such a segment. Unlike the LDT, the GDT is shared between all processes and may contain TSS and LDT descriptors. For the kernel, the first entry is required to be a null descriptor and the code and data segments. To support user-mode processes, additional TSS, code, and data segments for ring 3 must be added.

The base address and size of the GDT are written to the GDTR register during boot (via. lgdt).

See also
ISDMv3, 2.4.1; Global Descriptor Table Register (GDTR)
ISDMv3, 3.5.1; Segment Descriptor Tables

Enumeration Type Documentation

◆ DescriptorType

Descriptor type.

Enumerator
DESCRIPTOR_SYSTEM 

entry is a system segment

DESCRIPTOR_CODEDATA 

entry is a code/data segment

◆ Gate

enum GDT::Gate

gate type

See also
ISDMv3, Table 3-2; System-Segment and Gate-Descriptor Types
Enumerator
GATE_TSS_BUSY 

when the task is currently running, otherwise GATE_TSS

GATE_TASK 

only for 16 bit

◆ Granularity

Unit of the segment limit.

Enumerator
GRANULARITY_BYTES 

Segment limit in Bytes.

GRANULARITY_4KBLOCK 

Segment limit in blocks of 4 Kilobytes.

◆ Size

enum GDT::Size

Address width.

Enumerator
SIZE_16BIT 

16-bit (D/B = 0, L = 0)

SIZE_32BIT 

32-bit (D/B = 1, L = 0)