fix: (maybe): remove gdt address
This commit is contained in:
parent
24c7ea8b19
commit
4ec1a4962d
@ -3,8 +3,7 @@
|
|||||||
#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
|
||||||
struct gdt_descriptor {
|
struct gdt_descriptor {
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user