1#ifndef ARION_GDT_MANAGER_HPP
2#define ARION_GDT_MANAGER_HPP
8#define ARION_GDT_ADDR 0xC0000000
9#define ARION_GDT_LIMIT 0x1000
10#define ARION_GDT_ENTRY_SZ 0x8
11#define ARION_GDT_ENTRIES_N 0x20
12#define ARION_GDT_PERMS 0x6
14#define ARION_GS_SEGMENT_ADDR 0xC0001000
15#define ARION_GS_SEGMENT_SZ 0x1000
16#define ARION_GS_SEGMENT_PERMS 0x6
18#define ARION_F_GRANULARITY 0x8
19#define ARION_F_PROT_32 0x4
20#define ARION_F_LONG 0x2
21#define ARION_F_AVAILABLE 0x1
22#define ARION_A_PRESENT 0x80
23#define ARION_A_PRIV_3 0x60
24#define ARION_A_PRIV_2 0x40
25#define ARION_A_PRIV_1 0x20
26#define ARION_A_PRIV_0 0x0
27#define ARION_A_CODE 0x10
28#define ARION_A_DATA 0x10
29#define ARION_A_TSS 0x0
30#define ARION_A_GATE 0x0
31#define ARION_A_EXEC 0x8
32#define ARION_A_DATA_WRITABLE 0x2
33#define ARION_A_CODE_READABLE 0x2
34#define ARION_A_DIR_CON_BIT 0x4
35#define ARION_S_GDT 0x0
36#define ARION_S_LDT 0x4
37#define ARION_S_PRIV_3 0x3
38#define ARION_S_PRIV_2 0x2
39#define ARION_S_PRIV_1 0x1
40#define ARION_S_PRIV_0 0x0
63 uint64_t
setup_entry(uint32_t base, uint32_t limit, uint8_t access, uint8_t flags);
107 void insert_entry(uint8_t idx, uint32_t base, uint32_t limit, uint8_t access, uint8_t flags);
A class used to setup and interact with the Global Descriptor Table (GDT).
Definition gdt_manager.hpp:49
ADDR gdt_addr
The address where the GDT stands in memory.
Definition gdt_manager.hpp:52
GdtManager(std::weak_ptr< Arion > arion)
Definition gdt_manager.hpp:76
std::weak_ptr< Arion > arion
The Arion instance this GdtManager instance is related to.
Definition gdt_manager.hpp:54
uint8_t find_free_idx(uint8_t start_idx)
uint64_t setup_entry(uint32_t base, uint32_t limit, uint8_t access, uint8_t flags)
uint32_t get_segment_base(uint16_t selector)
uint16_t setup_selector(uint8_t idx, uint16_t flags)
void insert_entry(uint8_t idx, uint32_t base, uint32_t limit, uint8_t access, uint8_t flags)
static std::unique_ptr< GdtManager > initialize(std::weak_ptr< Arion > arion)
Definition arch_x86-64.hpp:11
uint64_t ADDR
Identifies a memory address.
Definition global_defs.hpp:36