diff --git a/core/src/main.zig b/core/src/main.zig index da2de2e..df44027 100644 --- a/core/src/main.zig +++ b/core/src/main.zig @@ -106,6 +106,7 @@ export fn _start(magic: u32, info: MultibootInfo) callconv(.C) noreturn { platform.platformEndInit(); + init.state = .Running; thread.enterTask(init); } diff --git a/core/src/thread.zig b/core/src/thread.zig index b850a76..1f0374c 100644 --- a/core/src/thread.zig +++ b/core/src/thread.zig @@ -6,13 +6,16 @@ const pmm = @import("pmm.zig"); const cpu = @import("arch/cpu.zig"); pub const ThreadState = enum { + Inactive, Running, + Blocked, }; pub const ThreadControlBlock = struct { id: u64, directory: ?*vmm.PageDirectory, regs: interrupts.InterruptStackFrame, + state: ThreadState, ticks: u64, }; @@ -82,6 +85,7 @@ pub fn createThreadControlBlock(allocator: *pmm.FrameAllocator) !*ThreadControlB thread.id = next_id.fetchAdd(1, .seq_cst); thread.directory = null; thread.regs = std.mem.zeroes(@TypeOf(thread.regs)); + thread.state = .Inactive; return thread; }