From 02fdb1313dce82ab7851be9d84947f5b1b636fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gr=C3=A9goire?= Date: Sun, 19 Apr 2026 19:27:54 -0400 Subject: [PATCH] fix(amd64): do sti at another point --- src/kern/amd64/init.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kern/amd64/init.zig b/src/kern/amd64/init.zig index b74c72b..e4ee8a9 100644 --- a/src/kern/amd64/init.zig +++ b/src/kern/amd64/init.zig @@ -77,12 +77,11 @@ fn early_cpu_init() linksection(r.init) void { // Enable syscall if supported. efer.sce = f.syscall; + // Enable NX. efer.nxe = true; amd64.write_msr(.Efer, @bitCast(efer)); - - amd64.sti(); } pub fn ap_entry(cpu_id: u32, booted: *std.atomic.Value(usize)) noreturn { @@ -94,6 +93,8 @@ pub fn ap_entry(cpu_id: u32, booted: *std.atomic.Value(usize)) noreturn { ki.sched.percpu.local().current_thread = pl.impl.smp.start_thread.local().*; + amd64.sti(); + _ = booted.fetchAdd(1, .monotonic); ke.ipl.lower(.Passive); @@ -115,4 +116,5 @@ pub fn early_init() linksection(r.init) void { amd64.write_msr(.GsBase, 0); int.init(); + amd64.sti(); }