From d9ffdf1527a8b8c8289241893f6411b7a84f7347 Mon Sep 17 00:00:00 2001
From: Ian Moffett <ian@osmora.org>
Date: Mon, 29 Jul 2024 19:41:02 -0400
Subject: kernel/amd64: cpu: Write cpu_info to IA32_GS_BASE

Instead of writing cpu_info to IA32_KERNEL_GS_BASE then using SWAPGS,
write the cpu_info pointer directly to IA32_GS_BASE

Signed-off-by: Ian Moffett <ian@osmora.org>
---
 sys/arch/amd64/amd64/machdep.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 2185028..3a1eeb1 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -159,8 +159,7 @@ cpu_startup(struct cpu_info *ci)
     idt_load();
 
     setup_vectors();
-    amd64_write_gs_base((uintptr_t)ci);
-    __ASMV("swapgs");           /* Get kernel GS */
+    wrmsr(IA32_GS_BASE, (uintptr_t)ci);
 
     init_tss(ci);
     try_mitigate_spectre();
-- 
cgit v1.2.3