feat(libSceLibcInternal): implement floating-point word access #13782

Merged
dr-hoseyn merged 12 commits from upstream-pr/13782 into main 2026-11-16 05:36:41 +00:00
dr-hoseyn commented 2026-10-31 06:07:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by dr-hoseyn on 2026-10-31T06:07:07Z.


What

Replace six throwing LibcInternal import stubs with typed _Plsw, _Pmsw, _FPlsw, _FPmsw, _LPlsw and _LPmsw word-pointer accessors. Return writable addresses within binary64, binary32 or padded 80-bit extended guest storage without reading or modifying it. The extended most-significant word is at byte 8, not at the end of the 16-byte storage. Null pointers throw. Public declarations are covered by the library umbrella.

The CTest executable links the actual production libSceLibcInternal DLL. It checks pointer identity, input preservation and writes for signed zero, subnormal, normal, infinity and NaN binary32/binary64 representations, extended storage/padding preservation, and null rejection for all six exports.

PS5 contract evidence: the word-selection model and signatures follow the referenced Dinkumware sources, and the extended layout agrees with the existing runtime, but no native PS5 measurement or retail-title validation is claimed. This is six exports, not a large coverage milestone.

Tested

Updated against upstream main at e65fe03113 in 0f7f048c30. Preserved the upstream power exports and kept the six word accessors as the only replacement exports. Corrected the malformed padding range flagged in review. The branch passed the local conventions and whitespace checks. The Windows results below are from the earlier production DLL build.

Windows, WinLibs GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, head b8e7051061:

  • Full project CMake configuration succeeded after initializing recursive submodules and configuring the Git CA bundle for the FFmpeg download.
  • Built production libSceLibcInternal and its libc/libkernel dependencies, plus guest_float_words_tests.
  • ctest --test-dir C:/Users/etm/.anyps5-build -R ^guest_float_words$ --output-on-failure: passed, linking the production library exports.
  • Conventions and whitespace checks pass. The public-header audit passed for the initial four-export version; final six-export audit was interrupted and is not claimed.
  • No full all-libraries build, complete test suite, Linux/macOS execution or console test.

Overlap review: the initial scan reported shared CMake/debt lines with #13724 (mutexes). Relocated the CMake registration and clarified the imported-name inventory without editing the shared name-list lines. git merge-tree --write-tree HEAD refs/pr/13724 now succeeds without conflicts. #5021, #11750 and #11751 conflict with main; their added library code was manually checked and implements none of these word helpers or NIDs. A current open-PR name search found no _LPlsw/_LPmsw implementation. The existing throwing exports are removed here rather than duplicated.

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: #14158 (merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5095093415 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13782). Originally posted by [dr-hoseyn](https://github.com/dr-hoseyn) on 2026-10-31T06:07:07Z. --- ### What Replace six throwing LibcInternal import stubs with typed `_Plsw`, `_Pmsw`, `_FPlsw`, `_FPmsw`, `_LPlsw` and `_LPmsw` word-pointer accessors. Return writable addresses within binary64, binary32 or padded 80-bit extended guest storage without reading or modifying it. The extended most-significant word is at byte 8, not at the end of the 16-byte storage. Null pointers throw. Public declarations are covered by the library umbrella. The CTest executable links the actual production libSceLibcInternal DLL. It checks pointer identity, input preservation and writes for signed zero, subnormal, normal, infinity and NaN binary32/binary64 representations, extended storage/padding preservation, and null rejection for all six exports. PS5 contract evidence: the word-selection model and signatures follow the referenced Dinkumware sources, and the extended layout agrees with the existing runtime, but no native PS5 measurement or retail-title validation is claimed. This is six exports, not a large coverage milestone. ### Tested Updated against upstream main at e65fe03113 in 0f7f048c30. Preserved the upstream power exports and kept the six word accessors as the only replacement exports. Corrected the malformed padding range flagged in review. The branch passed the local conventions and whitespace checks. The Windows results below are from the earlier production DLL build. Windows, WinLibs GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, head b8e7051061: - Full project CMake configuration succeeded after initializing recursive submodules and configuring the Git CA bundle for the FFmpeg download. - Built production `libSceLibcInternal` and its libc/libkernel dependencies, plus `guest_float_words_tests`. - `ctest --test-dir C:/Users/etm/.anyps5-build -R ^guest_float_words$ --output-on-failure`: passed, linking the production library exports. - Conventions and whitespace checks pass. The public-header audit passed for the initial four-export version; final six-export audit was interrupted and is not claimed. - No full all-libraries build, complete test suite, Linux/macOS execution or console test. Overlap review: the initial scan reported shared CMake/debt lines with #13724 (mutexes). Relocated the CMake registration and clarified the imported-name inventory without editing the shared name-list lines. `git merge-tree --write-tree HEAD refs/pr/13724` now succeeds without conflicts. #5021, #11750 and #11751 conflict with main; their added library code was manually checked and implements none of these word helpers or NIDs. A current open-PR name search found no `_LPlsw`/`_LPmsw` implementation. The existing throwing exports are removed here rather than duplicated. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #14158 (merged) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
jotitadev commented 2026-10-31 09:36:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T09:36:46Z.

Review: COMMENTED


Linux run of head b8e705106, merged (--no-commit) onto main 809c7fa2df. Ubuntu 26.04 (kernel 7.0), GCC 15.2.0, CMake 4.2.3, Ninja, Release, BUILD_TESTING=ON, i7-8700.

  • guest_float_words (linked against the production libSceLibcInternal) passes 3/3.
  • Full build ok. public_headers: 65/65. Related subset guest_math|guest_float|guest_floating|libc_internal|LibcInternal|guest_trig|guest_libc: 16/16.
  • Red, keeping the test: _Pmsw offset + 6 changed to + 4 makes it abort 3/3; a throw at the top of each of the six exports also aborts it 3/3.
  • main + #13778 + #13782 + #13835 (shared CMakeLists.txt with #13778; Export.cpp and libSceLibcInternal.hpp with #13835) merge cleanly; full build ok, the same subset 17/17 three times, public_headers 65/65.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722199287 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13782#pullrequestreview-5722199287). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-31T09:36:46Z. **Review:** COMMENTED --- Linux run of head `b8e705106`, merged (`--no-commit`) onto `main` `809c7fa2df`. Ubuntu 26.04 (kernel 7.0), GCC 15.2.0, CMake 4.2.3, Ninja, Release, `BUILD_TESTING=ON`, i7-8700. - `guest_float_words` (linked against the production `libSceLibcInternal`) passes 3/3. - Full build ok. `public_headers`: 65/65. Related subset `guest_math|guest_float|guest_floating|libc_internal|LibcInternal|guest_trig|guest_libc`: 16/16. - Red, keeping the test: `_Pmsw` offset `+ 6` changed to `+ 4` makes it abort 3/3; a `throw` at the top of each of the six exports also aborts it 3/3. - `main` + #13778 + #13782 + #13835 (shared `CMakeLists.txt` with #13778; `Export.cpp` and `libSceLibcInternal.hpp` with #13835) merge cleanly; full build ok, the same subset 17/17 three times, `public_headers` 65/65. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!13782
No description provided.