Pass arguments to main via runtime.process.Init, dispatched on signature

This commit is contained in:
Daniel Samson
2026-07-11 14:22:48 +01:00
parent d218d93f79
commit 75ccfff171
6 changed files with 112 additions and 39 deletions
+4 -2
View File
@@ -90,8 +90,10 @@ process) instead of silently corrupting the image
(`buildEntryStack` in `system/kernel/process.zig`); `argv[0]` is always the path
or initial-ramdisk name the process was spawned as, and `system_spawn`'s optional
argument blob becomes `argv[1..]`. The runtime's `_start`
(`library/runtime/start.zig`) hands the block to `rt_start`, which exposes it as
`runtime.argumentCount()` / `runtime.argument(i)`. A C runtime's `crt0` would walk
(`library/runtime/start.zig`) hands the block to `rt_start`, which builds a
`runtime.process.Init` from it and passes that to the program's `main`
(`pub fn main(init: runtime.process.Init)`; a parameterless `main()` is also
accepted). A C runtime's `crt0` would walk
the identical layout unmodified — that's the compatibility being bought. The
`args` test proves the round trip.