global descriptor table
More...
◆ Segment
Code segments.
Enumerator |
---|
Null | null descriptor
|
K_CS | kernel code segment
|
K_DS | kernel data segment
|
U_CS | user code segment
|
U_DS | user data segment
|
Definition at line 16 of file gdt.h.
◆ Install_gdt()
void GDT::Install_gdt |
( |
| ) |
|
Creates global descriptor entries in gdt_table, and loads into CPU.
We are going to use x86 protected mode, thus the segment selectors won't be used for either virtual memory, or memory protection. However since segmentation cannot be turned off on an x86, we simply set the kernel/user space segments to 0 base to simulate flat memory model
- See also
- Segmentation in x86 in practice
Definition at line 125 of file gdt.cpp.
◆ Load_gdt()
void GDT::Load_gdt |
( |
void * |
gdtAddress, |
|
|
uint16_t |
LimitUse |
|
) |
| |
|
inline |
assembly instruction to load gdt table to CPU
- Parameters
-
Definition at line 104 of file gdt.cpp.
◆ SEG_OFFSET()
constexpr uint8_t GDT::SEG_OFFSET |
( |
const Segment |
Seg | ) |
|
|
inline |
Translates code segment enum to code segment selector.
- Parameters
-
Seg | - enum of kernel/user space code/data segment |
- Returns
- Byte position of code segment in gdt_table
Definition at line 29 of file gdt.h.
◆ SetGlobalDescriptorEntry()
void GDT::SetGlobalDescriptorEntry |
( |
GdtEntry |
GdtTable[], |
|
|
const Selector |
SelectorTable[] |
|
) |
| |
Set entries in GdtTable from array of Selector.
- Parameters
-
[out] | GdtTable | to be loaded into CPU later |
[in] | SelectorTable | used to specify entries to GdtTable |
Definition at line 82 of file gdt.cpp.
◆ GDT_ENTRIES
const uint8_t GDT::GDT_ENTRIES = 5 |
Definition at line 12 of file gdt.h.
◆ KERN_CS_BASE
const uint32_t GDT::KERN_CS_BASE = 0x00000000 |
◆ KERN_CS_GRANULARITY
const uint8_t GDT::KERN_CS_GRANULARITY = 0xC0 |
◆ KERN_CS_LIMIT
const uint32_t GDT::KERN_CS_LIMIT = 0x000FFFFF |
◆ KERN_DS_BASE
const uint32_t GDT::KERN_DS_BASE = 0x00000000 |
◆ KERN_DS_GRANULARITY
const uint8_t GDT::KERN_DS_GRANULARITY = 0xC0 |
◆ KERN_DS_LIMIT
const uint32_t GDT::KERN_DS_LIMIT = 0x000FFFFF |
◆ NULL_BASE
const uint32_t GDT::NULL_BASE = 0x00000000 |
◆ NULL_GRANULARITY
const uint8_t GDT::NULL_GRANULARITY = 0x00 |
◆ NULL_LIMIT
const uint32_t GDT::NULL_LIMIT = 0x00000000 |
◆ USER_CS_BASE
const uint32_t GDT::USER_CS_BASE = 0x00000000 |
◆ USER_CS_GRANULARITY
const uint8_t GDT::USER_CS_GRANULARITY = 0xC0 |
◆ USER_CS_LIMIT
const uint32_t GDT::USER_CS_LIMIT = 0x000FFFFF |
◆ USER_DS_BASE
const uint32_t GDT::USER_DS_BASE = 0x00000000 |
◆ USER_DS_GRANULARITY
const uint8_t GDT::USER_DS_GRANULARITY = 0xC0 |
◆ USER_DS_LIMIT
const uint32_t GDT::USER_DS_LIMIT = 0x000FFFFF |