feat: add TSS
This commit is contained in:
+9
-3
@@ -1,4 +1,5 @@
|
||||
#include "gdt.hpp"
|
||||
#include "task.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
static volatile u16* const s_vga = reinterpret_cast<volatile u16*>(0xB8000);
|
||||
@@ -16,7 +17,9 @@ static inline void puts(const char* str, u8 row, u8 col) {
|
||||
s_vga[col + off + (VGA_COLS * row)] = 0x0700 | str[off];
|
||||
}
|
||||
|
||||
static constexpr gdt_entry s_gdt[5] = {
|
||||
static constexpr tss s_tss{};
|
||||
|
||||
static gdt_entry s_gdt[] = {
|
||||
// Null Descriptor
|
||||
gdt_entry{ 0, 0, 0, 0 },
|
||||
// Kernel Mode Code Segment
|
||||
@@ -40,8 +43,11 @@ static constexpr gdt_entry s_gdt[5] = {
|
||||
gdt_entry::ACCESS_P | gdt_entry::ACCESS_DPL3 | gdt_entry::ACCESS_S | gdt_entry::ACCESS_E | gdt_entry::ACCESS_RW,
|
||||
gdt_entry::FLAG_G | gdt_entry::FLAG_L },
|
||||
// Task State Segment
|
||||
// gdt_entry{ 0, 0, gdt_entry::ACCESS_P | gdt_entry::ACCESS_E | gdt_entry::ACCESS_A, 0 },
|
||||
// gdt_entry{ 0 }
|
||||
gdt_entry{ static_cast<u32>(reinterpret_cast<u64>(&s_tss) & 0xFFFFFFFF),
|
||||
sizeof(s_tss) - 1,
|
||||
gdt_entry::ACCESS_P | gdt_entry::ACCESS_E | gdt_entry::ACCESS_A,
|
||||
0 },
|
||||
gdt_entry{ static_cast<u32>(reinterpret_cast<u64>(&s_tss) >> 32) }
|
||||
};
|
||||
|
||||
extern "C" void kmain(void) {
|
||||
|
||||
Reference in New Issue
Block a user