The source layout now mirrors the runtime filesystem hierarchy
(docs/danos-file-system-hierarchy-FSH.md): what lives under system/ in the
source is what a running danos represents under /system. Each service and
driver is a sub-project directory that is its own Zig module — cross-project
references go by module name, never by a path into another project's files.
Moves (all git mv, history preserved):
- src/ -> system/ (danos internals; the self-representation)
root.zig -> danos.zig (the kernel<->user contract module)
kernel/arch/ -> kernel/architecture/ (arch -> architecture)
device/ -> devices/ (what /system/devices reflects)
boot/ -> /boot (the loaders, top level)
- sbin/ -> split by role:
init, vfs -> system/services/<name>/<name>.zig
hpetd, busd -> system/drivers/<name>/<name>.zig
vfs-test -> system/services/vfs/vfs-test.zig (inside the vfs project)
- lib/ -> library/runtime/ (room for other libraries beside runtime)
The VFS wire protocol becomes its own module, system/services/vfs/protocol.zig
("vfs-protocol"): the vfs sub-project exposes its interface, and the runtime's
file layer imports it by name. First instance of the "protocol module" pattern
(docs/driver-model.md); usb/block will expose theirs the same way.
Also: fix a naming-standard violation in the protocol — Op -> Operation (and
req -> request, _pad -> _padding). Docs updated: /system/services added to the
FHS doc, a repository-layout section added to the docs index, and stale source
paths swept across comments and docs.
Runtime boot paths are unchanged (the bootloader still loads /sbin/init);
aligning the runtime filesystem to the FHS is a separate follow-up. Suite 35/35
plus host tests green.
31 lines
1.6 KiB
Zig
31 lines
1.6 KiB
Zig
//! Kernel tunables — the compile-time knobs, gathered in one place.
|
|
//!
|
|
//! These constants would otherwise be scattered across the files that use them,
|
|
//! hiding the trade-offs. Keeping them here makes them visible at a glance and gives
|
|
//! one spot to change them. They're plain `comptime` constants (zero runtime cost);
|
|
//! any one can later be promoted to a `-D` build option if a target needs to vary it
|
|
//! (see build.zig's `-Dtest-case` for the pattern). This keeps root.zig to what it
|
|
//! actually is — the bootloader↔kernel handoff *contract* — with tunables living here.
|
|
|
|
/// Ceiling on logical CPUs the kernel tracks — the size of the per-CPU bookkeeping
|
|
/// arrays (discovery pool, scheduler state, per-core GDT/TSS). Generous headroom:
|
|
/// those structs are small, and the *large* per-core resources (kernel and IST
|
|
/// stacks) are allocated at bring-up for cores that actually come online, so this
|
|
/// ceiling is cheap. A machine with more logical CPUs has its surplus reported and
|
|
/// left parked (see acpi `cpusDropped`).
|
|
pub const maximum_cpus = 128;
|
|
|
|
/// Maximum tasks (kernel threads) alive at once — the static task-table size. Each
|
|
/// online core consumes one slot for its idle task, plus task 0 on the BSP.
|
|
pub const maximum_tasks = 16;
|
|
|
|
/// Each task's kernel stack (also each AP's bring-up stack), in bytes.
|
|
pub const kernel_stack_size = 16 * 1024;
|
|
|
|
/// Each core's IST (double-fault) stack, in bytes. The BSP's is static; an AP's is
|
|
/// heap-allocated at bring-up.
|
|
pub const ist_stack_size = 16 * 1024;
|
|
|
|
/// Scheduler tick / preemption rate, in Hz (the timer's periodic frequency).
|
|
pub const timer_hz = 1000;
|