Kernel: move GDT initialization to boot.S

This commit is contained in:
Bananymous
2023-01-22 00:47:25 +02:00
parent aac7595a47
commit 491610db2c
5 changed files with 88 additions and 132 deletions

View File

@@ -1,8 +1,44 @@
#pragma once
#include <stdint.h>
namespace GDT
{
void initialize();
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[];
}