allocate AP kernel/IST stacks at bring-up, not statically

Hoist max_cpus into danos (root.zig), raise it to 128, and stop reserving a static [max_cpus][16 KiB] IST array. Only the BSP's IST stack is static (needed before the allocator); each AP's is heap-allocated when it comes online. Shrinks the kernel from ~1.1 MB to ~139 KiB in ReleaseSmall.
This commit is contained in:
Daniel Samson
2026-07-08 16:04:18 +01:00
parent 26ac97df31
commit 1b47de5058
8 changed files with 56 additions and 10 deletions
+8
View File
@@ -45,6 +45,14 @@ pub const Framebuffer = extern struct {
/// targets so far.
pub const page_size = 4096;
/// Ceiling on logical CPUs the kernel tracks — the size of the per-CPU bookkeeping
/// arrays (discovery pool, scheduler state, per-core GDT/TSS). A generous headroom:
/// these structs are small (a few hundred bytes each), and the *large* per-core
/// resources (IST/kernel stacks) are allocated at bring-up, only for cores that
/// actually come online — so this ceiling costs little. A machine with more logical
/// CPUs than this has its surplus reported and left parked (see acpi `cpusDropped`).
pub const max_cpus = 128;
/// danos's own classification of a span of physical memory — deliberately not
/// UEFI's vocabulary. Each boot path (UEFI now, device tree later) translates its
/// native memory description into these kinds, so the kernel never learns what