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:
@@ -32,6 +32,11 @@ macro_rules! bounded {
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn const_new(value: $inner) -> Self {
|
||||
assert!(value >= Self::MIN && value <= Self::MAX, "bounded value out of range");
|
||||
Self(value)
|
||||
}
|
||||
|
||||
pub fn value(&self) -> $inner {
|
||||
self.0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user