Repository navigation
fix(libc): correct guest exception callback ABI on Windows - #1840
Merged
oneandonlydean merged 2 commits intoOct 10, 2026
Merged
Conversation
Guest message throws registered native Windows callbacks even though Release invokes guest callbacks using System V. Register an APS5_VABI adapter in the standard and regex message throw paths and retain the native DestroyMessage helper and legacy callback storage type. Add MinGW CTest regressions with distinct or zero RCX, shared and final-release messages, typed guest catches, rethrow and normal Release. All ten new cases plus Windows exception and thread callback regressions pass three repetitions. Linux execution remains unvalidated; guest vtables and host exception paths are unchanged.
Give guest exception what, non-deleting destructor and deleting destructor slots explicit APS5_VABI types and register guest adapters. Preserve native helpers, object layouts, native exception routing and existing malloc/free ownership. Add mismatched and cleared RCX regressions for plain and message vtables, observing actual libc free calls to reject foreign or duplicate frees. Retain typed guest catch/rethrow and native exception coverage. All 27 targeted CTests pass three repetitions on Windows Release; Linux execution remains unvalidated.
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 10, 2026
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 10, 2026
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…-abi fix(libc): correct guest exception callback ABI on Windows
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.
What
Correct two Windows calling-convention mismatches in libc's guest exception runtime. Guest calls pass the object pointer in RDI under System V, but the registered message-destructor lambdas and exception vtable entries previously used native Windows function pointers expecting RCX.
APS5_VABImessage-destructor adapter for standard message throws andregex_error. The adapter calls the unchanged native destruction helper. The legacy destructor pointer storage and native/guest allocation markers remain unchanged.what, non-deleting destructor and deleting destructor slots explicitAPS5_VABItypes and use guest adapters for all plain/message exception vtables. Each adapter calls the correctly declared native helper.Normal Release previously happened to leave the same object in RDI and RCX, masking the registered-callback defect. Deliberately supplying a different object in RCX reproduced destruction of the wrong message; clearing RCX reproduced an invalid read. Virtual calls showed the same mismatch.
Object and RTTI layouts, message reference counting, existing malloc/free ownership, native host helpers and native exception routing are preserved. Deleting-destructor tests use standalone malloc-owned objects; they do not delete exceptions owned by the exception allocator. No new exception export aliases are added.
The two commits form one runtime ABI fix: the second extends the regression fixture introduced by the first. There is no dependency on the separate math or hardware-concurrency changes.
Potential overlap: #1551 also edits
core/libs/prx/libc/CMakeLists.txt. Itsprecise_waitregistration and this PR's MinGW exception-test block are in different current hunks. There is no functional dependency, but the shared file should be checked when either PR is merged.Tested
Windows 10 x86-64, MinGW GCC 15.2, Ninja, Release,
BUILD_TESTING=ON. Validation was repeated on this independent PR branch, head05e1cf9d, based on upstream04477932.windows_exceptions,guest_thread_callback_abi,guest_exception_handler,guest_raise_exceptionandguest_unwind_module_info.git diff --check, the official conventions check againstorigin/main, and the test-registration check passed. The registration checker reports no newly unregistered executable targets.Linux source compatibility was reviewed:
APS5_VABIis empty there, native helper semantics are unchanged, and the Windows assembly/IAT regressions are MinGW-only. Linux build and runtime tests were not run because no usable Linux environment was available. These self-authored guest fixtures validate AnyPS5's runtime model, not proprietary PS5 SDK layouts or physical-console behavior.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)