Time is a kernel concern in danos: the kernel owns the scheduling timer and already exposes monotonic time via the clock/sleep/timer_bind syscalls, so a userspace time service would be a redundant, slower path. This adds the generic runtime.time module over those syscalls, retires the two demonstration drivers, reorganizes the milestone docs, and makes the monotonic clock correct on Intel, AMD, and inside any VM. runtime.time (library/runtime/time.zig) - Instant/Duration interface: now, sleep, spin, after, monotonicNanos, available - a thin layer over system.clock/sleep/timerOnce; unit-tested arithmetic Remove the demo drivers hpet and bus (a teaching example belongs in the docs, not shipped in the tree) - system/drivers/ now holds only real drivers: pci-bus, ps2-bus, usb-xhci-bus - device-manager end-to-end test repointed to pci-bus (asserts on kernel state: the process table and the device tree, not a racy serial marker) - device_register containment moved to a new in-kernel `containment` test - the driver-model worked example moved inline into docs/drivers.md Reorganize milestone docs into topic docs - m17-m18 / m19-m20 / m21 plans dissolved into process-lifecycle, device-manager, discovery, and acpi docs; new docs/power.md and docs/timers.md; ~20 citations repointed; plan docs deleted TSC reliability (apic.zig, smp.zig, cpu.zig, kernel.zig) - check the invariant-TSC bit (CPUID 0x80000007 EDX[8]) on Intel and AMD - cross-core "warp" check at SMP bring-up, pairwise BSP<->AP as each core comes up - fall back to the HPET clocksource when the TSC is not invariant (a bare VM) or not synchronized (a warp), switched continuously so time never jumps - boot log reports the outcome; new tsc-sync test exercises the TSC + warp path Verified: zig build; zig build test; 60/60 QEMU cases (incl. new containment and tsc-sync).
53 lines
2.6 KiB
Zig
53 lines
2.6 KiB
Zig
//! danos user-space runtime library — a nascent libc. Every user binary (init,
|
|
//! and later the VFS server + device drivers) imports this as `@import("runtime")`:
|
|
//! system_call wrappers, the C-convention heap, IPC helpers, and the process start
|
|
//! shim. It is compiled into each binary (inheriting its `.large` code model and
|
|
//! freestanding target), so all user programs share one implementation.
|
|
//!
|
|
//! A user binary needs three lines:
|
|
//! const runtime = @import("runtime");
|
|
//! pub const panic = runtime.panic;
|
|
//! comptime { _ = &runtime.start._start; } // pull the entry shim in
|
|
//! and a `pub fn main() void` or `pub fn main(init: runtime.process.Init) void`
|
|
//! (arguments arrive via `init`).
|
|
|
|
pub const system = @import("system.zig");
|
|
/// Monotonic time, delays, and deadlines over the kernel clock/sleep/timer syscalls
|
|
/// — an `Instant`/`Duration` front door, no time service (docs/timers.md).
|
|
pub const time = @import("time.zig");
|
|
pub const heap = @import("heap.zig");
|
|
pub const ipc = @import("ipc.zig");
|
|
pub const start = @import("start.zig");
|
|
/// The VFS wire protocol (shared with the VFS server).
|
|
pub const vfs_protocol = @import("vfs-protocol");
|
|
|
|
/// The device-manager protocol: hello + tree reports (docs/device-manager.md).
|
|
pub const device_manager_protocol = @import("device-manager-protocol");
|
|
|
|
/// The power protocol: events (button, lid, battery) + shutdown (docs/power.md).
|
|
pub const power_protocol = @import("power-protocol");
|
|
/// Keyboard-event listening (subscribe/next) and broadcasting (publish), over the input
|
|
/// service. See library/runtime/input.zig and system/services/input/.
|
|
pub const input = @import("input.zig");
|
|
/// The input wire protocol (shared with the input service and its clients).
|
|
pub const input_protocol = @import("input-protocol");
|
|
/// POSIX-style file API: open/read/write/lseek/stat/close.
|
|
/// C stdio: fopen/fread/fwrite/fseek/ftell/fclose over unistd.
|
|
/// Device access for drivers: enumerate/claim/mmioMap.
|
|
pub const device = @import("device.zig");
|
|
/// DMA-capable memory for drivers: contiguous, pinned, uncacheable buffers.
|
|
pub const dma = @import("dma.zig");
|
|
|
|
/// Re-exported so a user binary can `pub const panic = runtime.panic;`.
|
|
pub const panic = start.panic;
|
|
|
|
/// Process entry types: the `Init` handed to `main`, and its `Arguments`.
|
|
pub const process = @import("process.zig");
|
|
|
|
/// The service harness: one replyWait loop folding requests, signals, and
|
|
/// notifications into callbacks (docs/process-lifecycle.md).
|
|
pub const service = @import("service.zig");
|
|
|
|
/// The heap as a `std.mem.Allocator`, for Zig `std` containers in user code.
|
|
pub const allocator = heap.allocator;
|