Renaming/Moving stuff into a different file structure

This commit is contained in:
2021-11-16 13:57:15 +01:00
parent 32909aaed9
commit 3a87b74224
28 changed files with 66 additions and 62 deletions

31
src/kernel/gdt/gdtc.cpp Normal file
View File

@ -0,0 +1,31 @@
#include "gdtc.h"
#include "../tty/kterm.h"
gdtEntry_t gdt[3];
gdtSegmentPointer gdtPointer{};
void gdtSetGate(int num, uint64_t base, uint64_t limit, uint8_t access,
uint8_t gran){
gdt[num].lBase = (base & 0xFFFF);
gdt[num].mBase = (base >> 16) & 0xFF;
gdt[num].hBase = (base >> 24) & 0xFF;
gdt[num].lLimit = (limit & 0xFFFF);
gdt[num].granularity = ((limit >> 16) & 0x0F);
gdt[num].granularity |= (gran & 0xF0);
gdt[num].access = access;
}
void setupGdt(){
gdtPointer.limit = (sizeof(gdtEntry_t) * 3) - 1;
gdtPointer.base = (uint32_t) &gdt;
gdtSetGate(0, 0, 0, 0, 0);
gdtSetGate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF);
gdtSetGate(2, 0, 0xFFFFFFFF, 0x92, 0xCF);
printf("call to load gdt\n");
load_gdt();
}