wip: TSS added to the gdt and start to implement scheduler

This commit is contained in:
2025-01-13 15:46:09 +01:00
parent 916e8b6f19
commit b9691b1948
9 changed files with 156 additions and 8 deletions

View File

@ -5,6 +5,7 @@
extern void set_gdt(uint32_t gdt_ptr);
struct tss TSS;
uint8_t gdt_entries[GDT_SIZE * 8];
struct gdt_descriptor *gdtr = (struct gdt_descriptor *)GDT_ADDRESS;
@ -90,6 +91,9 @@ void init_gdt(void)
GDT_ACCESS_RW_READABLE_FOR_CODE_WRITABLE_FOR_DATA |
GDT_ACCESS_A_ACCESSED,
GDT_FLAG_32BIT_MODE | GDT_FLAG_PAGE_MODE); // User stack
// TSS
set_gdt_entry_value(gdt_entries + GDT_OFFSET_TSS, (uint32_t)&TSS,
sizeof(struct tss) - 1, 0x89, 0);
set_gdt(((uint32_t)gdtr));
}