ke: add continuations

This commit is contained in:
Loïc Grégoire
2026-08-29 20:03:22 -04:00
parent d06351f31c
commit 8226a205a0
20 changed files with 735 additions and 194 deletions
+12 -12
View File
@@ -12,22 +12,22 @@ export fn kmain(boot_info: *r.BootInfo) callconv(.c) void {
r.boot_info = boot_info;
// Immediately initialize the context of what will eventually become
// our idle thread. We keep running on the loader stack up until we switch
// into the thread.
thread0.init(
boot_info.kernel_stack,
boot_info.kernel_stack_size,
.IdleThread,
init,
null,
);
// our idle thread. At this point we're already running on the kernel stack.
thread0.init(.{
.stack = boot_info.kernel_stack + boot_info.kernel_stack_size,
.priority = .IdleThread,
.entry = undefined,
// Shouldn't block
.turnstile = undefined,
});
thread0.continuation = null;
thread0.pinned = true;
// Jump into the thread.
thread0.context.load();
init();
}
pub fn init(_: ?*anyopaque) linksection(r.init) void {
fn init() linksection(r.init) void {
ke.ncpus = 1;
ki.impl.early_init();
ki.tunable.init();