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
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//! runtime.zig — a **compatibility shim** for the runtime split (reorg C1–C5).
|
||||
//!
|
||||
//! `library/runtime` became `library/kernel`, and the one giant `runtime` module is being
|
||||
//! split into directly-importable concern modules (`ipc`, `memory`, `process`, `time`,
|
||||
//! `logging`, `file-system`, `service`, `thread`, `start`, plus the device/service clients).
|
||||
//! This file re-exports those modules under the old `runtime.*` names so the ~38 consumers
|
||||
//! keep compiling until each is migrated to direct imports. Deleted in step C5.
|
||||
|
||||
pub const system = @import("system"); // the system.zig compatibility shim
|
||||
pub const ipc = @import("ipc");
|
||||
pub const memory = @import("memory");
|
||||
pub const allocator = memory.allocator;
|
||||
pub const process = @import("process");
|
||||
pub const service = @import("service");
|
||||
pub const Thread = @import("thread").Thread;
|
||||
pub const time = @import("time");
|
||||
pub const log = @import("logging");
|
||||
pub const logging = @import("logging");
|
||||
pub const fs = @import("file-system");
|
||||
pub const start = @import("start");
|
||||
pub const panic = start.panic;
|
||||
|
||||
// Device / service clients (now in library/device/driver, library/device/block, library/client).
|
||||
pub const device = @import("driver");
|
||||
pub const device_manager = @import("driver"); // hello() folded into driver
|
||||
pub const input = @import("input");
|
||||
pub const block = @import("block");
|
||||
pub const display = @import("display");
|
||||
|
||||
/// The heap as a namespace (`runtime.heap.allocator()`), plus `runtime.allocator`.
|
||||
pub const heap = struct {
|
||||
pub const allocator = memory.allocator;
|
||||
};
|
||||
|
||||
/// `runtime.dma.*` mapped onto the flat `memory` API (memory groups heap+dma+shared-memory).
|
||||
pub const dma = struct {
|
||||
pub const Region = memory.DmaRegion;
|
||||
pub const coherent = memory.dma_coherent;
|
||||
pub const write_combining = memory.dma_write_combining;
|
||||
pub const below_4g = memory.dma_below_4g;
|
||||
pub const alloc = memory.dmaAlloc;
|
||||
pub const free = memory.dmaFree;
|
||||
};
|
||||
|
||||
/// `runtime.shared_memory.*` mapped onto the flat `memory` API.
|
||||
pub const shared_memory = struct {
|
||||
pub const Region = memory.SharedRegion;
|
||||
pub const create = memory.sharedCreate;
|
||||
pub const map = memory.sharedMap;
|
||||
pub const physical = memory.sharedPhysical;
|
||||
};
|
||||
@@ -1,66 +0,0 @@
|
||||
//! system.zig — a **compatibility shim**, not the real home of anything anymore.
|
||||
//!
|
||||
//! The runtime's syscall surface used to be dumped here in one file. It has been split by
|
||||
//! concern into `time` / `logging` / `process` / `file-system` / `memory`. This re-exports
|
||||
//! the old flat `system.*` names from those homes so consumers that still write
|
||||
//! `runtime.system.write` (etc.) keep compiling until they migrate to the concern modules.
|
||||
//! Deleted once nothing references `runtime.system` (reorg step C5).
|
||||
|
||||
const memory = @import("memory");
|
||||
const process = @import("process");
|
||||
const time = @import("time");
|
||||
const logging = @import("logging");
|
||||
const file_system = @import("file-system");
|
||||
|
||||
// memory
|
||||
pub const PROT_READ = memory.PROT_READ;
|
||||
pub const PROT_WRITE = memory.PROT_WRITE;
|
||||
pub const PROT_EXEC = memory.PROT_EXEC;
|
||||
pub const mmap = memory.mmap;
|
||||
pub const munmap = memory.munmap;
|
||||
pub const mmapFailed = memory.mmapFailed;
|
||||
|
||||
// process
|
||||
pub const ProcessDescriptor = process.ProcessDescriptor;
|
||||
pub const yield = process.yield;
|
||||
pub const exit = process.exit;
|
||||
pub const spawn = process.spawn;
|
||||
pub const spawnWithArguments = process.spawnWithArguments;
|
||||
pub const spawnSupervised = process.spawnSupervised;
|
||||
pub const processes = process.processes;
|
||||
pub const isProcessRunning = process.isProcessRunning;
|
||||
pub const kill = process.kill;
|
||||
|
||||
// time
|
||||
pub const clock = time.clock;
|
||||
pub const wallClock = time.wallClock;
|
||||
pub const sleep = time.sleepMillis;
|
||||
pub const timerOnce = time.timerOnce;
|
||||
|
||||
// logging
|
||||
pub const write = logging.write;
|
||||
pub const writeRecord = logging.writeRecord;
|
||||
pub const klogRead = logging.klogRead;
|
||||
pub const klogStatus = logging.klogStatus;
|
||||
pub const KlogLevel = logging.KlogLevel;
|
||||
pub const KlogStatus = logging.KlogStatus;
|
||||
pub const KlogRecordHeader = logging.KlogRecordHeader;
|
||||
pub const klog_record_header_size = logging.klog_record_header_size;
|
||||
pub const klog_record_alignment = logging.klog_record_alignment;
|
||||
pub const klog_record_magic = logging.klog_record_magic;
|
||||
pub const klog_flag_truncated = logging.klog_flag_truncated;
|
||||
pub const klog_maximum_message = logging.klog_maximum_message;
|
||||
pub const maximum_process_name = logging.maximum_process_name;
|
||||
|
||||
// file-system
|
||||
pub const FsRoute = file_system.FsRoute;
|
||||
pub const fsResolve = file_system.fsResolve;
|
||||
pub const fsNodeRead = file_system.fsNodeRead;
|
||||
pub const fsNodeStatus = file_system.fsNodeStatus;
|
||||
pub const fsNodeReaddir = file_system.fsNodeReaddir;
|
||||
pub const fsMount = file_system.fsMount;
|
||||
pub const fsUnmount = file_system.fsUnmount;
|
||||
pub const FileAttributes = file_system.FileAttributes;
|
||||
pub const DirectoryEntryHeader = file_system.DirectoryEntryHeader;
|
||||
pub const file_kind_regular = file_system.file_kind_regular;
|
||||
pub const file_kind_directory = file_system.file_kind_directory;
|
||||
Reference in New Issue
Block a user