The one giant `runtime` module (with a `system.zig` that was itself a dumping ground of unrelated syscalls) is split into directly-importable, flat concern modules under library/kernel/: system-call ipc memory process thread time logging file-system service start (+ the device/service clients: device, device-manager, block, display, input) system.zig is dissolved — its functions moved to their concern home (mmap -> memory, spawn/kill/exit -> process, sleep/clock -> time, write/klog -> logging, fs* -> file-system). `memory` merges heap+dma+shared-memory behind one flat API (memory.allocator/dmaAlloc/sharedCreate/mmap), keeping heap's state and malloc export single. The memory<->thread dependency cycle (heap needs Thread.Mutex, thread needs mmap) is broken by having thread allocate its own stack via the raw mmap syscall, so the module graph is a DAG. This is the atomic step: all 42 internal cross-imports flip from relative to module imports at once. `runtime.zig` and `system.zig` become thin re-export SHIMS so the ~38 consumers keep compiling on `runtime.*` untouched; they migrate to direct imports in C2, after which the shims are deleted (C5). zig build + zig build test green; 14 QEMU cases pass (smoke, process, process-kill, thread-spawn/join, logger, vfs, fat-mount, display-native, usb-storage, virtio-gpu, device-manager, input, power-button).
52 lines
2.1 KiB
Zig
52 lines
2.1 KiB
Zig
//! 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 (relocated to library/device and library/client in C3/C4).
|
||
pub const device = @import("device");
|
||
pub const device_manager = @import("device-manager");
|
||
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;
|
||
};
|