fix: sync kernel tests with current API, add CapSlot::const_new

Tests:
- IPC tests: spawn thread B explicitly (CreateProcess no longer
  spawns threads since the boot logic fix)
- Memory tests: RequestPages now returns Value(va) not Slot(cap)
- MockPlatform: tracks VA→PA mappings for translate_va
- ReleasePages test: ignored (RequestPages no longer creates
  regions — ReleasePages needs redesign)

CapSlot::const_new(value):
- const fn that panics at compile time for invalid values
- Replaces CapSlot::new(N).unwrap() in init, echo, snake
- Cap slot constants are now compile-time verified

Also fixes handle_release_pages to use translate_va instead of
treating VA as PA directly.

35 kernel tests pass, 1 ignored.
This commit is contained in:
2026-10-18 22:17:42 +02:00
parent a3b15e5264
commit 61e28f0af5
8 changed files with 72 additions and 46 deletions

View File

@@ -17,8 +17,8 @@ fn setup_ipc_kernel() -> (
) {
let (mut k, pid_a) = kernel_with_process();
// Create process B
let proc_b_slot = match k.handle_syscall(Syscall::CreateProcess {
// Create process B (CreateProcess no longer spawns threads)
let _proc_b_slot = match k.handle_syscall(Syscall::CreateProcess {
create_cap: CapSlot::new(0).unwrap(),
image: types::address::DataRef::empty(),
}) {
@@ -26,9 +26,12 @@ fn setup_ipc_kernel() -> (
_ => panic!("expected slot"),
};
// Get process B's pid from the cap
let pid_b = ProcessId::from_raw(1);
let tid_b = ThreadId::from_raw(1);
let tid_b = k.spawn_thread_for_test(
pid_b,
Priority::new(16).unwrap(),
TimeSlice::new(100),
);
// Create an endpoint
let ep_id = k.create_endpoint_for_test();