C5: delete the runtime.zig and system.zig compatibility shims
With every consumer migrated (C2), nothing imports `runtime` or `system` any longer. Removed both shim files and their build.zig module definitions, dropped the `runtime` entry from `default_imports`, and rewrote the per-binary root shim (library/kernel/root.zig) to import `start` (_start + panic) and `logging` (std_options) directly instead of through `runtime`. addUserBinary/addThreadedUserBinary/addUserBinaryImpl lose their `runtime_module` parameter; the root module now pulls the two modules it needs out of `default_imports` via a small findImport helper. The runtime dumping ground is gone: the userspace library is library/kernel (concern modules), library/device (driver/pci/usb/block/model/mmio/acpi data), library/client (display, input service clients), and library/protocol (wire contracts). Consumers @import concern modules by name. Verified: zig build, zig build test, and QEMU (smoke, thread-spawn, thread-mutex, logger, display-native, device-manager, usb-storage, input).
This commit is contained in:
+12
-11
@@ -1,25 +1,26 @@
|
||||
//! 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.
|
||||
//! `main` (dispatched by start's comptime dispatch) 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 start = @import("start");
|
||||
const logging = @import("logging");
|
||||
const program = @import("program");
|
||||
|
||||
/// Resolved as `@import("root").main` by runtime.start's comptime dispatch.
|
||||
/// Resolved as `@import("root").main` by 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;
|
||||
/// The panic handler for every safety check in the image (start.panic).
|
||||
pub const panic = start.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`.
|
||||
/// stamps the sender; see the logging module). 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;
|
||||
if (@hasDecl(program, "std_options")) program.std_options else logging.default_options;
|
||||
|
||||
comptime {
|
||||
_ = &runtime.start._start; // pull the runtime entry shim into the image
|
||||
_ = &start._start; // pull the entry shim into the image
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user