feat(pbs): add explicit guest lifecycle hooks

This commit is contained in:
2026-10-28 09:12:48 +00:00
parent eb7d6a2398
commit 9504f4694a
41 changed files with 1209 additions and 24 deletions
+38
View File
@@ -60,6 +60,44 @@ is deliberately load-only because its entry requires arguments. Native binding
uses SYSTEM for the positive case and NONE for missing-capability rejection;
all other cases use NONE. Resource tests explicitly lower default limits.
## PBS controlled guest lifecycle qualification
Generate the source corpus and installed example, then run both runtime profiles:
```sh
./gradlew :prometeu-architecture-tests:test --tests '*PbsGuestLifecycleTest' :prometeu-app:installedKnowledgeTest
python3 tools/pbx-conformance/run.py --runtime ../runtime --lifecycle-only
python3 tools/pbx-conformance/run.py --runtime ../runtime --lifecycle-only --release
```
`PbsGuestLifecycleTest` emits ordinary/optimized production PBX for both hooks,
each independently and neither, ordinary direct calls, fatal traps, total fuel
exhaustion and successful calls spanning slices. Arbitrary function names and
unmarked functions named BeforePause/BeforeResume distinguish role metadata from
name conventions. An actual workspace import/reexport case selects one original
declaration without requiring colocation with Frame. A conflicting declaration
must fail project analysis. Synthetic binary fixtures explicitly cover direct
and transitive FRAME_SYNC rejection; they do not add PBS sync syntax.
`lifecycle.rs` loads these images with the production VM and runs the production
Firmware/SystemOS foreground path using the standard TestPlatform hardware.
Home/resume asserts exact ordered guest effects, unchanged continuation PC and
game-session ticks/frames during hooks, preserved heap/global state and a single
Init execution. Direct suspension and Shell foreground handoff must not add a
reaction tick. A partial frame retains its existing operand and call frame while
controlled hooks run. Ordinary direct calls do not acquire a controlled context.
The independent 1,500,000-cycle fuel budget survives slices and debugger stops;
single stepping uses the same accounting. Fatal trap/fuel/sync cases cannot run
subsequent gameplay or publish a logical frame. After a crash, counters are read
from the retained game session rather than the newly active crash UI. Probe
functions run only as terminal observations after continuation/frame assertions.
The runner adds production firmware/driver dependencies to its temporary Cargo
project. Sources, manifests, lockfiles and build outputs in the runtime checkout
remain untouched. This is local lifecycle conformance; installed runtime/game
qualification and MemcardBoot/persistence remain separate scopes.
Negative fixtures mutate Java-produced bytes independently of the writer to
exercise malformed input that the writer correctly refuses to construct.
Initialization JSON comes from `prometeu_system::CrashReport`, and is checked