Skip to main content

test_sub_vm_reread_recurse/
lib.rs

1//! Sub-VM recursion test guest that **re-reads its memory after the
2//! `host_call` returns** — the case the bench guests (`sub-vm-recurse`,
3//! `sub-vm-data-recurse`) deliberately omit (they return a register value and
4//! touch no memory on the way up).
5//!
6//! Each level reads its 64 KiB pinned RO mapping (page-in on the way down) and
7//! CoW-writes its 4 KiB initial-slot RW page, then `derive_spawn`s + `host_call`s
8//! a child. After the child HALTs and the level **resumes**, it re-reads both
9//! the RO and the RW data and folds them into its return value.
10//!
11//! The post-resume re-read makes each level exercise the full category-#3 path
12//! (RO-unit page-in + CoW) on both the way down and the way up.
13//! `tests/sub_vm_gas_parity.rs` drives this guest and asserts the recursion's
14//! gas is affine in depth (identical per-level charge — a multi-frame
15//! determinism guard). It was originally the regression test for the runtime
16//! eviction-recharge fork: a frame whose page table was evicted while paused and
17//! rebuilt on resume must not re-charge category-#3 for pages it already paid
18//! for. Eviction has since been removed (the call stack is bounded
19//! structurally), so the gas state lives on the `KernelFrame` purely to survive
20//! any future runtime reclamation (host-backed swap).
21
22#![cfg_attr(target_os = "none", no_std)]
23
24use subsoil as _;