diff options
author | dzwdz | 2022-05-21 21:24:15 +0200 |
---|---|---|
committer | dzwdz | 2022-05-21 21:24:15 +0200 |
commit | ef52650c4a0723b242deb72ce2726f6846a6e986 (patch) | |
tree | bdf42a732d694a58cdae1ba8314ae98e096e2399 /src/kernel/arch/i386/gdt | |
parent | e0101ecf0d2f29d8860e865e3f333803af918f2e (diff) |
kernel/i386: only map what's absolutely necessary in the user
Diffstat (limited to 'src/kernel/arch/i386/gdt')
-rw-r--r-- | src/kernel/arch/i386/gdt/gdt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/kernel/arch/i386/gdt/gdt.c b/src/kernel/arch/i386/gdt/gdt.c index 56df995..f016caa 100644 --- a/src/kernel/arch/i386/gdt/gdt.c +++ b/src/kernel/arch/i386/gdt/gdt.c @@ -4,6 +4,7 @@ #include <stdbool.h> #include <stdint.h> +extern char _isr_stack_top; struct gdt_entry { uint64_t limit_low : 16; @@ -37,7 +38,9 @@ struct lgdt_arg { uint32_t base; } __attribute__((packed)); +__attribute__((section(".text.early"))) static struct gdt_entry GDT[SEG_end]; +__attribute__((section(".text.early"))) static struct tss_entry TSS; static struct lgdt_arg lgdt_arg; // probably doesn't need to be global @@ -80,7 +83,7 @@ static void gdt_prepare(void) { // tss memset(&TSS, 0, sizeof(TSS)); TSS.ss0 = SEG_r0data << 3; // kernel data segment - TSS.esp0 = (uintptr_t) &_bss_end; + TSS.esp0 = (uintptr_t) &_isr_stack_top; GDT[SEG_TSS] = (struct gdt_entry) { .limit_low = sizeof(TSS), |