mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-27 13:58:20 +00:00
38 lines
939 B
Zig
38 lines
939 B
Zig
const std = @import("std");
|
|
const r = @import("root");
|
|
const pl = r.pl;
|
|
const ke = r.ke;
|
|
const arch = r.arch;
|
|
const ki = ke.private;
|
|
const ex = r.ex;
|
|
|
|
var thread0: ke.Thread = undefined;
|
|
var stack: [r.kib(16)]u8 align(16) = undefined;
|
|
|
|
pub fn init(boot_info: *r.BootInfo) linksection(r.init) void {
|
|
r.boot_info = boot_info;
|
|
ke.ncpus = 1;
|
|
ki.impl.early_init();
|
|
ki.tunable.init();
|
|
std.log.info("Welcome to the machine", .{});
|
|
pl.early_init();
|
|
ki.log.init();
|
|
ki.cpu.init_cpu(0);
|
|
ki.turnstile.init_turnstiles();
|
|
|
|
thread0.init(
|
|
@intFromPtr(&stack),
|
|
r.kib(16),
|
|
ke.Thread.Priority.idle_low,
|
|
ki.sched.idle,
|
|
null,
|
|
);
|
|
thread0.priority = 0;
|
|
thread0.base_priority = 0;
|
|
thread0.pinned = true;
|
|
|
|
ki.sched.percpu.local().current_thread = &thread0;
|
|
|
|
std.log.info("Zag for {s} ({s}), cmdline is \"{?s}\"", .{ pl.name, arch.name, boot_info.cmdline });
|
|
}
|