Handout
This commit is contained in:
36
kernel/arch/gdt.cc
Normal file
36
kernel/arch/gdt.cc
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "gdt.h"
|
||||
|
||||
#include "core.h"
|
||||
|
||||
namespace GDT {
|
||||
|
||||
// The static 32-bit Global Descriptor Table (GDT)
|
||||
alignas(16) constinit SegmentDescriptor protected_mode[] = {
|
||||
// Null descriptor
|
||||
{},
|
||||
|
||||
// Global code segment von 0-4GB
|
||||
SegmentDescriptor::Segment(0, UINT32_MAX, true, 0, Size::Bit32),
|
||||
|
||||
// Global data segment von 0-4GB
|
||||
SegmentDescriptor::Segment(0, UINT32_MAX, false, 0, Size::Bit32),
|
||||
};
|
||||
extern "C" constexpr Pointer gdt_protected_mode_pointer(protected_mode);
|
||||
|
||||
// The static 64-bit Global Descriptor Table (GDT)
|
||||
// \see [ISDMv3 3.2.4 Segmentation in IA-32e
|
||||
// Mode](intel_manual_vol3.pdf#page=91)
|
||||
alignas(16) constinit SegmentDescriptor long_mode[] = {
|
||||
// Null descriptor
|
||||
SegmentDescriptor::Null(),
|
||||
|
||||
// Global code segment
|
||||
SegmentDescriptor::Segment64(true, 0),
|
||||
|
||||
// Global data segment
|
||||
SegmentDescriptor::Segment64(false, 0),
|
||||
|
||||
};
|
||||
extern "C" constexpr Pointer gdt_long_mode_pointer(long_mode);
|
||||
|
||||
} // namespace GDT
|
||||
Reference in New Issue
Block a user