M4: /sbin/init as PID 1 — a heartbeat process
init is now a real scheduled ring-3 process: it prints a heartbeat and sleeps, forever. The kernel spawns it at boot via spawnProcess (its own address space, preemption on) and the boot context drops to idle — the system's steady state is "kernel idle, init alive in ring 3", beating ~1 Hz. Adds the sleep(ms) syscall. The init/process tests are reshaped around the heartbeat (repeated syscalls, still-alive, two concurrent processes on distinct address spaces). Pins init to LLD and folds the .large code model's .ltext/.lrodata/.ldata into the linker script so its code segment is R+X. Removes the now-dead borrowed-thread ELF loader (runInitElf); spawnProcess is the one path. Docs updated. Suite 28/28. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
37fb3cb0cf
commit
b9d9e1e523
@@ -173,6 +173,11 @@ pub fn build(b: *std.Build) void {
|
||||
init_exe.setLinkerScript(b.path("sbin/linker.ld"));
|
||||
init_exe.entry = .{ .symbol_name = "_start" };
|
||||
init_exe.image_base = 0x7000_0000_0000;
|
||||
// The self-hosted linker ignores the script's PHDRS (segment permissions),
|
||||
// which the kernel's W^X user-ELF loader requires (code must be R+X). Pin to
|
||||
// LLVM + LLD so the script is authoritative.
|
||||
init_exe.use_llvm = true;
|
||||
init_exe.use_lld = true;
|
||||
b.installArtifact(init_exe);
|
||||
|
||||
// Boot methods live in src/boot/, one per way of getting the kernel running.
|
||||
|
||||
Reference in New Issue
Block a user