From ea952efe8aaa6f9f77b5e642a495185bc03762ca Mon Sep 17 00:00:00 2001 From: Gabriel Date: Sat, 15 Feb 2025 22:58:34 +0100 Subject: [PATCH] core: Fix a few bugs in threading code g_threads is processor-specific now, so it's unused, and setPageDirectory() needs the physical address. --- core/src/thread.zig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/thread.zig b/core/src/thread.zig index 80aa620..b850a76 100644 --- a/core/src/thread.zig +++ b/core/src/thread.zig @@ -19,8 +19,6 @@ pub const ThreadControlBlock = struct { pub const ThreadList = std.DoublyLinkedList(ThreadControlBlock); -var g_threads: ThreadList = .{}; - const ALLOCATED_TICKS_PER_TASK = 20; pub fn enterTask(task: *ThreadControlBlock) noreturn { @@ -44,7 +42,7 @@ pub fn switchTask(regs: *interrupts.InterruptStackFrame, new_task: *ThreadContro regs.* = new_task.regs; if (new_task.directory) |directory| { - if (vmm.readPageDirectory() != directory) vmm.setPageDirectory(directory); + if (vmm.readPageDirectory() != directory) vmm.setPageDirectory(vmm.getPhysicalPageDirectory(directory)); } new_task.ticks = ALLOCATED_TICKS_PER_TASK;