feat(kernel): per-process budgets (pages, endpoints, notifs, regions) carved from creator, returned on death; init owns pool

This commit is contained in:
2026-10-27 15:08:58 +01:00
parent 7415bab7f5
commit 4049ba5007
46 changed files with 672 additions and 119 deletions

View File

@@ -3,6 +3,7 @@
use super::{call0, raw, slot_of};
use types::address::{EntryPoint, StackPointer};
use types::bounded::CapSlot;
use types::budget::Limits;
use types::id::ProcessId;
use types::syscall_abi::*;
use types::time::Ticks;
@@ -38,10 +39,18 @@ pub fn get_process_id() -> ProcessId {
ProcessId::from_raw(call0(SYS_GET_PROCESS_ID).map_or(0, |r| r[1]) as u16)
}
pub fn create_process(create_cap: CapSlot) -> Option<CapSlot> {
/// The new process's `limits` come out of this process's own budget.
pub fn create_process(create_cap: CapSlot, limits: Limits) -> Option<CapSlot> {
slot_of(raw(
SYS_CREATE_PROCESS,
[create_cap.value() as usize, 0, 0, 0, 0, 0],
[
create_cap.value() as usize,
limits.pages,
limits.endpoints,
limits.notifications,
limits.regions,
0,
],
))
.ok()
}