fix(libc): correct guest exception callback ABI on Windows #1840
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1840"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Prophet069 on 2026-10-08T21:14:58Z.
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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T04:18:38Z.
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.
main)core/libs/tests/GuestMessageDestructorAbi.Score/libs/tests/GuestMessageDestructorAbi.cpp