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

@@ -16,8 +16,11 @@ use crate::windows::MAX_WINDOWS;
/// a 1280x800 window; high, clear of the GPU's mappings and of the heap,
/// which grows from the bottom.
const BUFFERS_VA: usize = 0x1000_0000;
const BUFFER_SPAN: usize = 0x0040_0000;
const PAGE: usize = 4096;
const BUFFER_SPAN: usize = types::display::window::BUFFER_PAGES * PAGE;
// Every window's buffer fits between here and the themes' reading buffer
// (0x1800_0000), below the heap's end.
const _: () = assert!(BUFFERS_VA + MAX_WINDOWS * BUFFER_SPAN <= 0x1800_0000 && 0x1800_0000 < types::layout::HEAP_END);
pub struct KernelHost {
/// The display's own endpoint, which window capabilities are minted

View File

@@ -7,7 +7,7 @@
use types::display::window::{BADGE, NAME_BYTES};
pub const MAX_WINDOWS: usize = 8;
pub use types::display::window::MAX_WINDOWS;
/// Events received and not yet polled by the window in front.
const QUEUED: usize = 32;

View File

@@ -24,6 +24,8 @@ use types::permission::{Permission, PermissionSet};
/// Client buffers sit high in storage's window, clear of its heap.
const BUFFERS_VA: VirtualAddress = VirtualAddress::from_raw(0x0100_0000);
// Every client's buffer fits below the disk driver's mappings (0x01D0_0000).
const _: () = assert!(0x0100_0000 + types::storage::MAX_CLIENTS * protocol::BUFFER_SIZE <= 0x01D0_0000);
const EP: CapSlot = CapSlot::const_new(0);

View File

@@ -9,8 +9,7 @@ use crate::scope::Scope;
mod session;
/// Connections at once: every program reading files, apps among them.
const MAX_CLIENTS: usize = 16;
use types::storage::MAX_CLIENTS;
/// Handles at or past this are never valid (the file systems hand out
/// fewer), so ownership fits a small table.
const MAX_HANDLES: usize = 16;