Files
stambha/crates
Garvit Surana f7db19a5d9 feat(hle): a guest access's fault inside a composite's fast path puts the call back at the function's entry as the fast path found it and runs the original's first instruction alone, so the original takes the fault, where such a fault stopped the PE as a native failure with no recovery row
native_fault first asks hle_fault: for a block with an HLE mark, a fault
at an offset before the mark's prefix end, from an x86 exception that is
a guest access's as native_fault judges one (a #PF with a plain
read/write error code, or a #GP/#SS of a non-canonical address), settles
the run as native_fault does at the block's first instruction with none
of it retired: pinned::settle over a copy of the state, the chain's
retired instructions added, the PC at the entry, a link's BTYPE applied.
The fast path writes no guest register or frame field before its commit
point, so that is the state the call entered with. It then sets the
bypass and counts it. The scheduler's step takes the bypass beside PACM
(always evaluated, so a stale one is cleared) and fetches the entry as a
single-instruction block: the original runs from its first word and
takes the fault itself, with ESR, FAR, ELR and state as without HLE. A
fault in the bail's code keeps its moved recovery row; any other trap in
a fast path still stops the PE.

The plan bypassed #PF only; accepting the non-canonical #GP/#SS too keeps
a fast path exact where the placement's limit lies past the host's
canonical range (the test host's five-level limit on a four-level host),
the faults native_fault already accepts at a guest access.

Tests: Touch with X0 unreadable equals the original in full and bypasses
once; three such calls on one machine bypass three times and stay exact;
every readable/unreadable/read-only combination of X0 and X1 agrees;
4000 random Touch cases bypass exactly when X0's page is unreadable;
pointers at or past the limit, tagged or in the upper half bail without
a fault, an unmapped one in range bypasses; software step never matches;
a reused session runs as a fresh machine with Touch on as well, and no
call with every page mapped bypasses. Mutations caught: no hook, no
prefix bound, no bypass taken.

Translator id unchanged: engine glue and tests only.
2026-11-22 17:57:06 +00:00
..