wire / wire-format / gdt-descriptor
An x86-64 GDT entry is 8 bytes (64 bits) for a code/data segment, or 16 bytes for a system segment (TSS, LDT, gate). Code/data segment: base (32 bits, split), limit (20 bits, split), access byte (8 bits: present, DPL, S, type), flags (4 bits: granularity, default size, long mode, available). In long mode (64-bit), base and limit are mostly ignored (flat model).
aka: x86-64 GDT (Global Descriptor Table) entry
spec: Intel 64 and IA-32 Architectures Software Developer's Manual
An x86-64 GDT entry is 8 bytes (64 bits) for a code/data segment, or 16 bytes for a system segment (TSS, LDT, gate). Code/data segment: base (32 bits, split), limit (20 bits, split), access byte (8 bits: present, DPL, S, type), flags (4 bits: granularity, default size, long mode, available). In long mode (64-bit), base and limit are mostly ignored (flat model).
| field | size | meaning |
|---|---|---|
| Limit (low) | 2 bytes (bits 0-15) | Low 16 bits of the segment limit. |
| Base (low) | 2 bytes (bits 16-31) | Low 16 bits of the base address. |
| Base (middle) | 1 byte (bits 32-39) | Bits 16-23 of the base address. |
| Access byte | 1 byte (bits 40-47) | Bit 7 = Present, bits 5-6 = DPL, bit 4 = S (1=code/data, 0=system), bits 0-3 = Type (code: execute/read, data: read/write, etc.). |
| Limit (high) + Flags | 1 byte (bits 48-55) | Bits 0-3 = Limit bits 16-19, bit 4 = Available, bit 5 = Long mode (L), bit 6 = Default size (D/B), bit 7 = Granularity (G, 0=byte, 1=4KB). |
| Base (high) | 1 byte (bits 56-63) | Bits 24-31 of the base address. |
example:
00 00 00 00 00 00 00 00
x86-64 GDT entry: all zeros (null descriptor)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/gdt-descriptor
or /wire-format/gdt-descriptor.json