Kernel: Initialize GDT in kernel code

We dont use the boot GDT only while booting
This commit is contained in:
Bananymous
2023-03-01 21:21:08 +02:00
parent 7f8cad83b1
commit 7fcbb869e1
8 changed files with 306 additions and 82 deletions

View File

@@ -2,43 +2,9 @@
#include <stdint.h>
namespace GDT
namespace Kernel::GDT
{
union SegmentDesriptor
{
struct
{
uint16_t limit_lo;
uint16_t base_lo;
uint8_t base_hi1;
uint8_t type : 4;
uint8_t system : 1;
uint8_t DPL : 2;
uint8_t present : 1;
uint8_t limit_hi : 4;
uint8_t flags : 4;
uint8_t base_hi2;
} __attribute__((packed));
struct
{
uint32_t low;
uint32_t high;
} __attribute__((packed));
} __attribute__((packed));
struct GDTR
{
uint16_t size;
void* address;
} __attribute__((packed));
extern "C" GDTR g_gdtr[];
extern "C" SegmentDesriptor g_gdt[];
void initialize();
}