feat(libc): implement feholdexcept #8863
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8863"
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 UnhealthyKraken on 2026-10-21T03:41:25Z.
What
Provide
feholdexcept(1kduKXMqx7k, libSceLibcInternal implemented by shared libc). It saves the current thread's 32-byte x87/MXCSR environment, clears pending exceptions and masks traps in both units while retaining other controls. Null output throws before any state changes.The public SDK declaration and amd64 layout, public 3.20 symbol table and independently matching NID database establish interface evidence. Behavior follows FreeBSD 11 amd64 fenv.c, alongside the existing fegetenv implementation. Console equivalence and module/library versions remain unverified and are recorded in libc debt. No proprietary module or capture is included.
Tested
Windows x86-64, GCC 15.2, Release. No games or GPU execution.
05f9995704ce700749880024243469924ad1db9afails on the missing export. Exactly the same test binaries, swapping only saved baseline/candidate libc, yield baseline one expected failure plus two passing math suites; candidate three passing suites.4f24b6a64c4d62ce01da251820d159a25d6b23fb. The libc sources/test/debt did not change from the original tested base; subsequent main changes were AGC, VideoOut and SystemService work.Independent Windows validation by xXPBSXx, Windows10 Pro/Ryzen7 5800X3D/WinLibs GCC15.2 Release: the existing guest_floating_point case passes three runs on this PR, and the identical test fails three runs after replacing only Math.cpp with merge-base4f24b6a64c. Only that test target was built. This is attributed reviewer evidence, not an own rerun or a full-suite/other-platform/console result.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T04:14:23Z.
Review: APPROVED
Reviewed the x87/MXCSR save and mask sequence and the test matrix.
fnstenvcaptures the x87 environment before its masking side effect, the explicitfnclexclears x87 pending exceptions, and the saved MXCSR is restored into the output before the new masked/cleared MXCSR is installed. The tests exercise bounds, null handling, errno, flags, controls and thread isolation. The implementation appropriately records that console equivalence is not measured. I found no blocking issue in the diff.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T07:44:28Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
mainis clean. I built onlyguest_floating_point_tests;ctest -N -R guest_floating_pointlists exactly one test.Results (3 runs each):
guest_floating_pointpasses 3/3.core/libs/prx/libc/src/Math.cppwith the version from the PR's merge base (4f24b6a64c), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by UnhealthyKraken on 2026-10-22T03:16:32Z.
Recorded the independent Windows result and its limits:
guest_floating_pointpasses three runs on the PR and fails three runs with the same test against merge-base Math.cpp. This corroborates the regression separately from my original Windows/full-library validation. It is not a full-suite, other-platform or console result. The review and test report identify no further implementation change.