library/runtime/log.zig wires std.log to the tagged ring: the root shim installs std_options for every binary (programs may override), logFn formats one line per record and emits it with its level via debug_write — the payload no longer carries the process's name; the kernel stamps identity structurally and the serial renderer prints the '<binary path>: ' prefix, so the transcript keeps its shape. Migrate every writeLine/logLine/log helper family (init, vfs, fat, device-manager, acpi, pci-bus, ps2-bus x3, usb-hid x2, usb-storage, usb-xhci-bus, virtio-gpu — 104 call sites) to std.log.info, dropping the hand-written prefixes. A leveled record is a complete line by contract (raw emissions may still build lines from pieces). Test fixtures and the display/input services keep raw writes for now — their ring records are attributed by the kernel regardless. Harness regexes follow the renamed prefixes (usb-hid-keyboard, discovery) and path-named restart lines.
26 lines
1.1 KiB
Zig
26 lines
1.1 KiB
Zig
//! The root module every user binary is compiled through (build.zig,
|
|
//! `addUserBinary`). The program's own file is imported as `program`, and this
|
|
//! shim contributes the declarations Zig resolves from the compilation root —
|
|
//! `main` (dispatched by runtime.start) and the panic handler — and pulls in the
|
|
//! `_start` entry shim. A program therefore only defines `pub fn main`; nothing
|
|
//! else is required in its source file.
|
|
|
|
const runtime = @import("runtime");
|
|
const program = @import("program");
|
|
|
|
/// Resolved as `@import("root").main` by runtime.start's comptime dispatch.
|
|
pub const main = program.main;
|
|
|
|
/// The panic handler for every safety check in the image (runtime.start.panic).
|
|
pub const panic = runtime.panic;
|
|
|
|
/// std.log for every user binary goes to the tagged kernel log ring (the kernel
|
|
/// stamps the sender; see runtime.log). A program overrides by declaring its
|
|
/// own `pub const std_options`.
|
|
pub const std_options: @import("std").Options =
|
|
if (@hasDecl(program, "std_options")) program.std_options else runtime.log.default_options;
|
|
|
|
comptime {
|
|
_ = &runtime.start._start; // pull the runtime entry shim into the image
|
|
}
|