Skip to content

feat(libc): implement fegetexcept - #9216

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Felipebmaitan:feat/libc-fegetexcept
Oct 24, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Felipebmaitan:feat/libc-fegetexcept

Conversation

@Felipebmaitan

Copy link
Copy Markdown
Contributor

What

Adds the missing fegetexcept export (VtRkfsD292M) by reusing the existing x87 trap query. It reports the six unmasked x87 exceptions without changing the floating-point environment or guest errno; SSE masks do not contribute to the result.

The name/NID is present in the pinned PS5 3.20 libSceLibcInternal export inventory. The behavior follows FreeBSD 11.4 amd64 fenv.h, lines 121-133, consistent with the existing floating-point implementation.

PS5 equivalence is unverified and recorded in docs/dev/debt/libc.md. A useful console check is to set the x87 and SSE exception masks independently, call the system-library export with no arithmetic that triggers a trap, and record the result and before/after environment and errno. In particular, x87-only and SSE-only enabled exceptions distinguish the assumed rule.

Tested

Windows 11 Pro 10.0.26200, x86-64, Release, WinLibs GCC 15.2.0 UCRT POSIX SEH r7, BUILD_TESTING=ON.

Passed:

  • Runtime libraries and relevant test executables: cmake --build build --target libs guest_floating_point_tests guest_math_tests guest_math_exact_tests guest_float_builtins_tests guest_fminf_tests patched_libraries_tests --parallel 6.
  • ctest --test-dir build -R '^(guest_floating_point|guest_math|guest_math_exact|guest_float_builtins|guest_fminf|patched_libraries)$' --output-on-failure: 6/6 passed, 0.56 s total. The extended floating-point test covers all 4,096 x87/SSE mask pairs, including denormal exceptions, mismatched rounding modes, sticky flags and errno preservation.
  • python tools/check_conventions.py --base origin/main.
  • git diff --check origin/main...HEAD.

The default full build, cmake --build build --parallel 6, was attempted and failed in the unchanged upstream core/libs/prx/libSceAgcDriver/tests/execution/ImageArrayWindowPastLayerLimit.cpp:33: alignas(65536) exceeds MinGW's object-file maximum alignment of 8192. The file is identical to base cecb540a63f614d2b06cbb557c6d1f6f02475fa3. The subsequent runtime-library and focused-test build above succeeded. The complete CTest suite was not run because the default build could not finish.

No PS5 or title run, and no local Linux/macOS execution. Full Linux/Windows PR CI requires a collaborator to dispatch the Build workflow as described in CONTRIBUTING; that has not been dispatched here.

Overlap: python tools/pr_overlap.py --branch feat/libc-fegetexcept --repo boykopovar/AnyPS5 was run. Test/debt insertion positions were separated from neighboring open PRs. The final run reports no same exports or conflicts with mergeable PRs. Thirteen PRs already conflict with main and share the debt file; their debt diffs were manually inspected and concern other entries. There is no functional dependency on another PR.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

Copy link
Copy Markdown

Progress report (cecb540 → 18213e0)

📈 System libraries: 42.11% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libc fegetexcept_nid_postfix

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 10129 docs/dev/debt/libc.md L5
PR 10134 docs/dev/debt/libc.md L5

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/libc.md
PR 5303 docs/dev/debt/libc.md
PR 7544 docs/dev/debt/libc.md
PR 7648 docs/dev/debt/libc.md
PR 7715 docs/dev/debt/libc.md
PR 8150 docs/dev/debt/libc.md
PR 8417 docs/dev/debt/libc.md
PR 8863 core/libs/tests/GuestFloatingPoint.cpp
docs/dev/debt/libc.md
PR 8965 docs/dev/debt/libc.md
PR 9133 docs/dev/debt/libc.md
PR 9232 docs/dev/debt/libc.md
PR 9342 docs/dev/debt/libc.md
PR 9408 docs/dev/debt/libc.md
PR 9447 docs/dev/debt/libc.md
PR 9526 docs/dev/debt/libc.md
PR 9527 docs/dev/debt/libc.md
PR 9552 docs/dev/debt/libc.md
PR 9669 docs/dev/debt/libc.md
PR 9833 docs/dev/debt/libc.md
PR 9844 docs/dev/debt/libc.md
PR 9873 docs/dev/debt/libc.md
PR 9929 docs/dev/debt/libc.md
PR 9945 docs/dev/debt/libc.md
PR 10002 docs/dev/debt/libc.md
PR 10003 docs/dev/debt/libc.md
PR 10007 docs/dev/debt/libc.md
PR 10113 docs/dev/debt/libc.md
PR 10226 docs/dev/debt/libc.md
PR 10229 docs/dev/debt/libc.md
PR 10253 docs/dev/debt/libc.md
PR 10274 docs/dev/debt/libc.md
PR 10283 docs/dev/debt/libc.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the export, implementation, tests, and remaining-debt note at head 18213e0. The new export is a direct alias of the existing x87 trap-mask query, matching FreeBSD's amd64 behavior described in the PR. The test independently varies all 4,096 x87/SSE mask combinations, checks that flags/control state and guest errno are unchanged, and exercises mask disagreement explicitly. The limitation is stated accurately: the PS5 inventory establishes the export name/NID, but console behavior has not been measured. Conventions, eligibility, intake, labels, Linux/macOS register-context and relinker matrices, Windows relinker, ASan, write-watch, and report checks pass. Full Linux/Windows product workflows are skipped by repository policy. No blocking issue found in the reviewed diff.

@oneandonlydean
oneandonlydean merged commit 09f62b9 into boykopovar:main Oct 24, 2026
18 checks passed
danielradosa added a commit to danielradosa/AnyPS5 that referenced this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants