ke: rework kernel initialization

This commit is contained in:
Loïc Grégoire
2026-08-05 16:10:37 -04:00
parent 4aaae63349
commit 2a09642f4d
11 changed files with 58 additions and 31 deletions
+4 -9
View File
@@ -11,8 +11,7 @@ const rtl = @import("rtl");
// XXX
const fbconsole = @import("../dev/fbconsole.zig");
export fn kmain(boot_info: *r.BootInfo) callconv(.c) void {
ke.init(boot_info);
pub fn init() void {
mm.init();
ps.init();
@@ -23,11 +22,11 @@ export fn kmain(boot_info: *r.BootInfo) callconv(.c) void {
exp.console.init();
exp.string.init();
if (boot_info.cmdline) |cline| {
if (r.boot_info.cmdline) |cline| {
if (rtl.cmdline.get_string(cline, "test")) |tst| {
// Run a test if specified.
if (r.tests.tests.get(tst)) |func| {
const t = ps.thread.create_kernel(ke.Thread.Priority.default, func, boot_info) catch @panic("oom");
const t = ps.thread.create_kernel(ke.Thread.Priority.default, func, r.boot_info) catch @panic("oom");
ke.sched.enqueue(&t.kern);
} else {
std.log.info("invalid test: \"{s}\"", .{tst});
@@ -35,11 +34,7 @@ export fn kmain(boot_info: *r.BootInfo) callconv(.c) void {
}
}
if (boot_info.framebuffer != null) {
if (r.boot_info.framebuffer != null) {
// fbconsole.init(boot_info);
}
while (true) {
std.atomic.spinLoopHint();
}
}
+2
View File
@@ -7,6 +7,8 @@ pub const DelayedWorkItem = p.work.DelayedWorkItem;
pub const Console = p.console.Console;
pub const InternedString = p.string.InternedString;
pub const init = p.init;
pub const work = struct {
pub const enqueue = p.work.enqueue;
pub const enqueue_in = p.work.enqueue_in;