runtime: preserve registers in ExitCriticalSection - #322
Merged
mstan merged 2 commits intoSep 6, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SYS(02h) ExitCriticalSection clears
v0, although the BIOS contract preserves the caller's general registers. A wrapper can return a prior BIOS result through this service; clearing it turns success into a false failure. Ghost in the Shell PAL SCES-01050 exposed this when movie startup entered cleanup while disc audio was already streaming.Remove the unwanted write, correct the syscall comment, and add a source-owned regression for the real handler. The interrupt-enable update and host continuation behavior remain unchanged. The contract is documented in PSX-SPX SYS(02h).
Validation
17f49ad3b20dc30917a881a02baaa25374c13d18; submitted head:49d5f6233c330c39346fda008c82c59675c8cbc2.v0and status-register state and compares the full CPU state. No BIOS or retail fixture is required.dirty_text_continuation_guardsexpectation,aot_overlay_discovery, and the Windows newline expectation inrelease_zip. The unchanged emitter is shared by the base/candidate source fixtures. After isolating compiler runtime DLLs, AOT reaches the samecheck_interior_fragment_contractassertion on both revisions.Skippedwith its reason. This verifies the visible coverage gap, not the register contract on Clang.git diff --checkand the accuracy-document link check pass.The same runtime correction was tested in a local GITS integration using owned SCES-01050 and retail SCPH5552. Recorded digital and analog routes show the opening, menu and New Game movie; the digital route reaches the first mission and its normal death/menu return. An unaffected Silent Bomber PAL SLES-02792 frontend control passes before and after. The operator accepted the corrected GITS build. These observations belong to that tested local integration, not a fresh gameplay run on the upstream-base build; full-campaign coverage is not claimed.
Review and scope
Fork review: Alexbeav/psxrecomp#21.
Cubic's two compiler-coverage comments are resolved. The current-head review check succeeds with no new issues. The fixture's LTO link recipe is restricted to its documented, verified Windows x64 MinGW GCC 16.1.0 toolchain; unsupported configurations still register a named CTest skip. Clang/MSVC register-preservation coverage is not claimed.
This is a runtime-only correction: consumers need a framework update and rebuild, without game-code regeneration. The four-file change contains no title-specific hook, retail payload, BIOS data, private paths or private tooling.
Developed with AI assistance; validated as described (test evidence in PR body). AI writes the code and the PR, but I always test before I send something up. Happy to iterate on this process with your feedback.