fix: capacities single-sourced in types (display MAX_WINDOWS/BUFFER_PAGES, storage MAX_CLIENTS), display + storage budgets derived from them, const asserts on VA layouts; kernel regions 64 -> 256

This commit is contained in:
2026-10-28 16:06:55 +01:00
parent 495bf03484
commit 3b71f29f4c
9 changed files with 38 additions and 15 deletions

View File

@@ -102,6 +102,11 @@ const fn server(name: &'static str, file: &'static [u8], limits: Limits) -> Prog
}
}
const DISPLAY_PAGES: usize = (types::display::window::MAX_WINDOWS + 1) * types::display::window::BUFFER_PAGES + 256;
/// A region per window, the screen's, the GPU's queues, and themes'
/// reading buffer.
const DISPLAY_REGIONS: usize = types::display::window::MAX_WINDOWS + 5;
/// Started on every boot. The log server comes first so the rest can print.
pub const SERVERS: &[Program] = &[
Program { console: true, ..server("log", b"bin/log", SMALL) },
@@ -118,9 +123,9 @@ pub const SERVERS: &[Program] = &[
// Its windows' state (input queues among it) is ~10 KiB, and the
// server is built on the stack.
stack_pages: 14,
// The framebuffer is ~1000 pages at 1280x800, and so is each of
// the (at most 8) windows' pixel buffers, which it owns.
..server("display", b"bin/display", Limits { pages: 9300, regions: 13, ..SMALL })
// The screen's pixel buffer and each window's, which it owns, and
// its own memory.
..server("display", b"bin/display", Limits { pages: DISPLAY_PAGES, regions: DISPLAY_REGIONS, ..SMALL })
},
// Text on the display, lines from the keyboard (it takes input focus).
// Its clients wait on lines and Ctrl+C. It draws its own text now,