diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-15 16:22:52 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-15 16:22:52 -0400 |
commit | 0f81f3e2adc1528e46ff8df7ef73281917df8adf (patch) | |
tree | 188219f5f2a14713c041db0baf7f4a1f67e12bdb /src/sys/arch/amd64/cpu | |
parent | 02b1c2dcc955d103e326efd46cc1b529dcd5e3aa (diff) |
kern/amd64: gdt: Load GDT before setting GS_BASE
If we update the GDTR after setting GS_BASE, we wont be referencing any
valid data anymore. Switch out the GDTR early on.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/arch/amd64/cpu')
-rw-r--r-- | src/sys/arch/amd64/cpu/cpu_conf.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sys/arch/amd64/cpu/cpu_conf.c b/src/sys/arch/amd64/cpu/cpu_conf.c index ee3bb78..b13e027 100644 --- a/src/sys/arch/amd64/cpu/cpu_conf.c +++ b/src/sys/arch/amd64/cpu/cpu_conf.c @@ -33,6 +33,7 @@ #include <machine/idt.h> #include <machine/trap.h> #include <machine/lapic.h> +#include <machine/gdt.h> /* * Initialize interrupt vectors @@ -58,6 +59,7 @@ void cpu_conf(struct pcore *pcore) { /* We use %GS to store the processor */ + gdt_load(); pcore->self = pcore; wrmsr(IA32_GS_BASE, (uintptr_t)pcore); |