fix: (maybe): remove gdt address

This commit is contained in:
Starnakin 2025-01-22 14:04:35 +01:00
parent 24c7ea8b19
commit 4ec1a4962d
2 changed files with 5 additions and 6 deletions

View File

@ -3,7 +3,6 @@
#include "tss.h" #include "tss.h"
#include <stdint.h> #include <stdint.h>
#define GDT_ADDRESS 0xC0105040
#define GDT_SIZE 8 #define GDT_SIZE 8
// https://wiki.osdev.org/Global_Descriptor_Table#GDTR // https://wiki.osdev.org/Global_Descriptor_Table#GDTR

View File

@ -7,7 +7,7 @@ extern void set_gdt(uint32_t gdt_ptr);
struct tss TSS; struct tss TSS;
uint8_t gdt_entries[GDT_SIZE * 8]; uint8_t gdt_entries[GDT_SIZE * 8];
struct gdt_descriptor *gdtr = (struct gdt_descriptor *)GDT_ADDRESS; struct gdt_descriptor gdtr;
static void set_gdt_entry_value(uint8_t *target, uint32_t base, uint32_t limit, static void set_gdt_entry_value(uint8_t *target, uint32_t base, uint32_t limit,
uint8_t access, uint8_t granularity) uint8_t access, uint8_t granularity)
@ -37,8 +37,8 @@ static void set_gdt_entry_value(uint8_t *target, uint32_t base, uint32_t limit,
void init_gdt(void) void init_gdt(void)
{ {
gdtr->size = 8 * GDT_SIZE - 1; gdtr.size = 8 * GDT_SIZE - 1;
gdtr->base = (uint32_t)&gdt_entries[0]; gdtr.base = (uint32_t)&gdt_entries[0];
set_gdt_entry_value(gdt_entries + 0x00, 0, 0, 0, 0); // Null segment set_gdt_entry_value(gdt_entries + 0x00, 0, 0, 0, 0); // Null segment
@ -95,5 +95,5 @@ void init_gdt(void)
set_gdt_entry_value(gdt_entries + GDT_OFFSET_TSS, (uint32_t)&TSS, set_gdt_entry_value(gdt_entries + GDT_OFFSET_TSS, (uint32_t)&TSS,
sizeof(struct tss) - 1, 0x89, 0); sizeof(struct tss) - 1, 0x89, 0);
set_gdt(((uint32_t)gdtr)); set_gdt(((uint32_t)&gdtr));
} }