diff --git a/core/src/arch/cpu.zig b/core/src/arch/cpu.zig index c015a88..43ec9dc 100644 --- a/core/src/arch/cpu.zig +++ b/core/src/arch/cpu.zig @@ -30,6 +30,7 @@ pub fn setupCore(allocator: *pmm.FrameAllocator) !void { idle_thread.regs = std.mem.zeroes(@TypeOf(idle_thread.regs)); idle_thread.state = .Running; idle_thread.user_priority = 0; + idle_thread.event_queue = null; thread.arch.initKernelRegisters(&idle_thread.regs); thread.arch.setAddress(&idle_thread.regs, @intFromPtr(&thread.arch.idleLoop)); diff --git a/core/src/thread.zig b/core/src/thread.zig index efc843a..5c706e2 100644 --- a/core/src/thread.zig +++ b/core/src/thread.zig @@ -1,10 +1,13 @@ const std = @import("std"); +const system = @import("system"); const vmm = @import("arch/vmm.zig").arch; const platform = @import("arch/platform.zig").arch; const pmm = @import("pmm.zig"); const cpu = @import("arch/cpu.zig"); const locking = @import("lib/spinlock.zig"); +const RingBuffer = system.ring_buffer.RingBuffer; + pub const arch = @import("arch/thread.zig").arch; pub const ThreadState = enum { @@ -20,6 +23,7 @@ pub const ThreadControlBlock = struct { regs: platform.Registers, state: ThreadState, user_priority: u8, + event_queue: ?RingBuffer, // Managed by addThreadToGlobalList(), no need to set manually. tag: GlobalThreadList.Node, @@ -146,6 +150,7 @@ pub fn createThreadControlBlock(allocator: *pmm.FrameAllocator) !*ThreadControlB thread.regs = std.mem.zeroes(@TypeOf(thread.regs)); thread.state = .Inactive; thread.user_priority = 127; + thread.event_queue = null; addThreadToGlobalList(thread);