// This file is part of noxos and licensed under the MIT open source license #ifndef NOX_GDT_H #define NOX_GDT_H #include "utils/stdtypes.h" typedef enum { GDT_SELECTOR_NULL = 0x00, GDT_SELECTOR_KERNEL_CODE = 0x08, GDT_SELECTOR_KERNEL_DATA = 0x10, GDT_SELECTOR_USER_NULL = 0x18, GDT_SELECTOR_USER_CODE = 0x20, GDT_SELECTOR_USER_DATA = 0x28 } gdt_selector_E; typedef struct { uint16_t size; uint64_t offset; }__attribute__((packed)) gdt_descriptor_T; typedef struct { uint16_t limit0; uint16_t base0; uint8_t base1; uint8_t access; uint8_t limit1_flags; uint8_t base2; }__attribute__((packed)) gdt_entry_T; typedef struct { gdt_entry_T null; // 0x00 gdt_entry_T kernel_code; // 0x08 gdt_entry_T kernel_data; // 0x10 gdt_entry_T user_null; // 0x18 gdt_entry_T user_code; // 0x20 gdt_entry_T user_data; // 0x28 }__attribute__((packed)) __attribute__((aligned(0x1000))) gdt_T; extern gdt_T g_default_gdt; void gdt_init(); #endif //NOX_GDT_H