interrupt: LoadGDT() with KERNEL_GDT_SIZE instead of calculating it

This commit is contained in:
Edgaru089 2021-11-14 18:19:10 +08:00
parent 7e9cc76ec5
commit c4b4dbeb18

View File

@ -41,6 +41,7 @@ void interrupt_Init() {
io_WriteConsoleASCII("interrupt_Init() calling\n"); io_WriteConsoleASCII("interrupt_Init() calling\n");
// set the 2 dummy gdts // set the 2 dummy gdts
memset((void *)KERNEL_GDT_MAPPING, 0, KERNEL_GDT_SIZE);
uint64_t *gdt = (uint64_t *)KERNEL_GDT_MAPPING; uint64_t *gdt = (uint64_t *)KERNEL_GDT_MAPPING;
gdt[0] = 0; gdt[0] = 0;
gdt[GDT_DATA_SELECTOR >> 3] = GDT_DATA; gdt[GDT_DATA_SELECTOR >> 3] = GDT_DATA;
@ -49,7 +50,7 @@ void interrupt_Init() {
gdt[GDT_EXEC_RING3_SELECTOR >> 3] = GDT_EXEC_RING3; gdt[GDT_EXEC_RING3_SELECTOR >> 3] = GDT_EXEC_RING3;
io_WriteConsoleASCII("GDT Installed\n"); io_WriteConsoleASCII("GDT Installed\n");
interrupt_LoadGDT(5 * GDT_SIZE_BYTES - 1, (void *)KERNEL_GDT_MAPPING); // set it! interrupt_LoadGDT(KERNEL_GDT_SIZE - 1, (void *)KERNEL_GDT_MAPPING); // set it!
io_WriteConsoleASCII("GDT OK\n"); io_WriteConsoleASCII("GDT OK\n");
//interrupt_Testcode(); //interrupt_Testcode();