P2.4–P2.9: kernel objects, ring 3, budgeted scheduler, IPC, IRQs and init (Phase 2 completion) #151
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #151"
general
weight: 0.35
garrickdabbs
Finishes the kernel half of Phase 2. P2.4–P2.9 were foundations only: no code ran in ring 3, IPC was non-blocking, the scheduler was a model that never switched threads, and IRQs reached nothing. Capability transfer also had bug #141. After this PR,
initboots from a Limine module and runs in ring 3 with real capabilities, budgets, blocking IPC and IRQ delivery.Needs maintainer action: ADR-0003 (an additive ABI v1 addendum) is Proposed. Phase 2 sign-off depends on accepting it.
Kernel objects and budgets (P2.4)
objects.rs: a single registry holds every object together with its state, behind the globalKernellock (objects::with, interrupts off).invokeBUDGET_CREATE/DESTROYcreate and destroy all 9 object types, charging and crediting the budget behind the capability.carv-budget.- the root budget;
- a budget that still pays for objects;
- an address space that a live thread still uses.
carv_budget::Budget(limitHEAP_SIZE) on every allocation and is refused when the charge fails. This closes the CLAUDE.md "known gap".Ring 3 and context switch (P2.5)
syscallentry stub switches to a per-thread kernel stack (mm/kstack.rs: 64 KiB slots, guard page, slot recycling).sysretq; first entry usesiretq. EFER.SCE is now set.mm/address_space.rs: user page tables share the kernel half, enforce W^X, and refuse addresses at or aboveUSER_TOP.Scheduler (P2.6)
IPC (P2.7, #141)
send,recv,callandreply_recvblock through the scheduler and use thecarv_abi::Messagewire layout.GRANTon it. The receiver's copy goes into its first empty slots as a child of the sender's capability, using the new cross-CSpace derivation tree (carv_caps::CapSpaces), so revoking the sender's capability removes it.IRQs (P2.8)
arch/x86_64/ioapic.rs) that honours ACPI ISA overrides. GSI n arrives on vector 48 + n.IrqControlandIrqcapabilities.IRQ_BINDroutes a line to a Notification and unmasks it.Irqobject is charged to the calling thread's budget, so it is reclaimed together with that budget.init (P2.9)
userland/initcrate.cargo xtask buildbuilds it intotarget/userland/, and every ISO ships it asboot():/boot/init.| Slot | Capability |
|---|---|
| 0 | root budget |
| 1 | its own thread |
| 2 | its own address space |
| 3 | IRQ control |
init: idleinstead ofhalting.ABI (ADR-0003, additive)
rax(status),rdxandrsi.invokemethods; object types 8 (Irq) and 9 (IrqControl).debug_putcis available in all builds until P3.4 (fixes the "debug builds only" line indocs/abi.md).carv-abi:ObjectType,method,map,init,USER_TOP.Tests
kernel/src/usertest.rs. User programs are written inglobal_asm!and run in ring 3:| Test | Checks |
|---|---|
|
ring3_thread_prints_and_destroys_itself|debug_putcfrom ring 3 ||
ring3_fault_kills_only_the_faulting_thread| fault isolation ||
budgets_split_the_cpu_thirty_seventy| 30/70 split within ±5% ||
ipc_call_reply_ping_pong| 2000 rounds; prints TSC cycles per round trip ||
ipc_transfers_a_capability_and_revoke_takes_it_back,revoke_removes_capabilities_transferred_to_another_cspace| transfer and revocation ||
irq_wakes_a_user_space_waiter| PIT IRQ wakes a user waiter ||
invoke_creates_and_destroys_every_object_type| create/destroy plus charges ||
init_module_is_a_valid_user_image| the shippedinitimage |test.rsadds:- kernel stack guard and recycling;
- address-space W^X and user bounds;
- heap budget charging;
- an updated syscall MSR test.
Docs
docs/abi.mdaddendum.docs/PLAN.md: P2 rows, §11 table and header status.CHANGELOG.md,README.md(boot sample,xtask build) andCLAUDE.md(build command, budget rule).Review notes
Scheduler::zombiesstaysVec<Box<Tcb>>(clippy::vec_boxallowed on purpose) so a dead thread's saved context doesn't move while the CPU switches away from it.task: P2.4
task: P2.5
task: P2.6
task: P2.7
task: P2.8
task: P2.9