feat(libSceLibcInternal): implement zero-return showmanyc exports #14401

Merged
xdCloudy merged 5 commits from upstream-pr/14401 into main 2026-11-06 01:07:51 +00:00
xdCloudy commented 2026-11-01 11:33:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xdCloudy on 2026-11-01T11:33:49Z.


What

Implements two existing libSceLibcInternal exports for std::basic_streambuf::showmanyc:

Export NID Specialization Return type
IAEl1Ta7yVU std::basic_streambuf<char> std::streamsize
olsoiZsezkk std::basic_streambuf<wchar_t> std::streamsize

Both implementations return zero without modifying the stream buffer.

Ghidra inspection of the locally held PS5 firmware 13.60 libSceLibcInternal.sprx resolved the NIDs at RVAs 0x00092b30 and 0x000c2c80. Both complete function bodies contain 31 c0 c3 (xor eax, eax; ret).

The revision-pinned ps5rs NID catalog identifies the narrow and wide Itanium names. The C++ stream buffer contract also specifies zero for the base showmanyc implementation.

Changes:

  • Correct both existing placeholder declarations to their identified signatures.
  • Implement both zero-return functions.
  • Preserve their NIDs and APS5_VABI calling convention.
  • Add focused regression tests for callable types, return values and unchanged buffer contents.
  • Update the library's technical-debt documentation.

No firmware binaries or new third-party dependencies are included.

Evidence

  • Identity: Local module/library/NID mapping and revision-pinned ps5rs symbol catalog.
  • ABI: Itanium C++ names establish the character specializations and std::streamsize signatures.
  • Behaviour: Both firmware function bodies return zero without reading arguments or accessing state.
  • Corroboration: The C++ standard specifies zero for the base implementation.
  • Limitations: No physical-console runtime measurement was performed. Behaviour is supported by local firmware inspection and public references.

Tested

Windows x86_64, WinLibs GCC, CMake/Ninja Release:

  • Built guest_libc_internal_showmanyc_tests; guest_libc_internal_showmanyc passed after integrating upstream main 5bae1a4bc2.
  • Conventions and diff whitespace checks passed.
  • Re-read the owned firmware module using its ELF program-header mappings: both addresses contain bytes 31 c0 c3. SHA-256: a2d70cc64c3abc3927662cbe0c3765b74b2385b4b2ad80eb7b942a891f9259fb.
  • Final head eeef26f744 additionally records the exact addresses/digest and static-evidence limits in technical debt; that final change is documentation only.

No console measurement or new full Linux/runtime-suite pass is claimed. New-head hosted checks are pending.

Overlap audit

Current upstream main 5bae1a4bc2 is integrated cleanly. The net PR diff remains the five intended files and the same two NIDs.

The earlier official overlap scanner failed closed on shared debt documentation and incomplete comparisons with conflicting external PRs. Those patches were manually examined and no duplicate implementation of either target NID was identified. No fresh passing official scanner run is claimed; that historical limitation remains disclosed. Adjacent changes may require ordinary merge-order reconciliation.

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
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5106940583 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14401). Originally posted by [xdCloudy](https://github.com/xdCloudy) on 2026-11-01T11:33:49Z. --- ### What Implements two existing `libSceLibcInternal` exports for `std::basic_streambuf::showmanyc`: | Export NID | Specialization | Return type | | --- | --- | --- | | `IAEl1Ta7yVU` | `std::basic_streambuf<char>` | `std::streamsize` | | `olsoiZsezkk` | `std::basic_streambuf<wchar_t>` | `std::streamsize` | Both implementations return zero without modifying the stream buffer. Ghidra inspection of the locally held PS5 firmware 13.60 `libSceLibcInternal.sprx` resolved the NIDs at RVAs `0x00092b30` and `0x000c2c80`. Both complete function bodies contain `31 c0 c3` (`xor eax, eax; ret`). The [revision-pinned ps5rs NID catalog](https://github.com/claimore22/ps5rs/blob/2304be5131221bae0dac24b9767cabffda33f747/data/nids.csv) identifies the narrow and wide Itanium names. The [C++ stream buffer contract](https://eel.is/c++draft/streambuf.virt.get) also specifies zero for the base `showmanyc` implementation. Changes: - Correct both existing placeholder declarations to their identified signatures. - Implement both zero-return functions. - Preserve their NIDs and `APS5_VABI` calling convention. - Add focused regression tests for callable types, return values and unchanged buffer contents. - Update the library's technical-debt documentation. No firmware binaries or new third-party dependencies are included. ### Evidence - **Identity:** Local module/library/NID mapping and revision-pinned ps5rs symbol catalog. - **ABI:** Itanium C++ names establish the character specializations and `std::streamsize` signatures. - **Behaviour:** Both firmware function bodies return zero without reading arguments or accessing state. - **Corroboration:** The C++ standard specifies zero for the base implementation. - **Limitations:** No physical-console runtime measurement was performed. Behaviour is supported by local firmware inspection and public references. ### Tested Windows x86_64, WinLibs GCC, CMake/Ninja Release: - Built `guest_libc_internal_showmanyc_tests`; `guest_libc_internal_showmanyc` passed after integrating upstream main `5bae1a4bc2`. - Conventions and diff whitespace checks passed. - Re-read the owned firmware module using its ELF program-header mappings: both addresses contain bytes `31 c0 c3`. SHA-256: `a2d70cc64c3abc3927662cbe0c3765b74b2385b4b2ad80eb7b942a891f9259fb`. - Final head `eeef26f744` additionally records the exact addresses/digest and static-evidence limits in technical debt; that final change is documentation only. No console measurement or new full Linux/runtime-suite pass is claimed. New-head hosted checks are pending. ### Overlap audit Current upstream main `5bae1a4bc2` is integrated cleanly. The net PR diff remains the five intended files and the same two NIDs. The earlier official overlap scanner failed closed on shared debt documentation and incomplete comparisons with conflicting external PRs. Those patches were manually examined and no duplicate implementation of either target NID was identified. No fresh passing official scanner run is claimed; that historical limitation remains disclosed. Adjacent changes may require ordinary merge-order reconciliation. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-01 13:59:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T13:59:57Z.

Review: COMMENTED


Reviewed — no blocking findings

The two showmanyc exports return zero without touching the buffer, which is what the base std::basic_streambuf::showmanyc contract specifies, and their NIDs match the Itanium names of those two specializations; I am not approving because the firmware evidence for the function bodies is not checkable here.

What I ran

  • Exact head 07857a0650086d3d972a77e62c3063c6ad9d575e, base b2620e56d1 (the PR base).
  • Environment: Linux, /usr/bin/python3 3.11.2, no build.
  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14401 --output-dir /dev/shm/reviewer-run/precheck/14401
  • ABI audit by hand (the helper is absent from the head tree): python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base b2620e56d1 --head 07857a0650086d3d972a77e62c3063c6ad9d575e --json (exit 0; passed; 0 findings).
  • NID identity computed with the repository's own function (tools/nid_names.py, compute_nid) for the Itanium names _ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv and _ZNSt15basic_streambufIwSt11char_traitsIwEE9showmanycEv: they give IAEl1Ta7yVU and olsoiZsezkk, the NIDs the exports carry.
  • Test-quality helper on core/libs/tests/GuestLibcInternalShowmanyc.cpp from a head extract: one literal-path registration heuristic; the test is registered in core/libs/prx/libSceLibcInternal/CMakeLists.txt with ${LIBS_INCLUDE_DIR}.
  • Source read at head: InventoryExports.cpp (both exports), include/InventoryExports.hpp (the typed declarations), the CMake registration and the test.

Results

Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14401/report.md):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check b2620e56d114ef053f8b45433b1d48aff7ec37ba...07857a0650086d3d972a77e62c3063c6ad9d575e
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 07857a0650086d3d972a77e62c3063c6ad9d575e --title feat(libSceLibcInternal): implement zero-return showmanyc exports --body /dev/shm/reviewer-run/precheck/14401/pr-body.md
changed_export_abi_audit failed /usr/bin/python3 tools/pr_abi_audit.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 07857a0650086d3d972a77e62c3063c6ad9d575e --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14401 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14401/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /usr/bin/python3 /dev/shm/reviewer-run/precheck/14401/head-07857a065008-1d05bca6/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14401/head-07857a065008-1d05bca6 --json core/libs/prx/libSceLibcInternal/CMakeLists.txt core/libs/prx/libSceLibcInternal/InventoryExports.cpp core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp core/libs/tests/GuestLibcInternalShowmanyc.cpp docs/dev/debt/libSceLibcInternal.md
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.

Hosted at this head: windows, conventions, library-portability and report succeeded; linux, relinker and relinker-asan were skipped by the workflow; three earlier conventions runs were cancelled.

Negative control

Not run. On base the test would fail to compile: its two static_asserts compare the export types with the int () declarations that base has, so the signature change is what the test checks.

Findings

Blocking: none.

Non-blocking:

  • The Ghidra inspection of firmware 13.60 that the PR cites (RVAs 0x00092b30 and 0x000c2c80, bodies 31 c0 c3) cannot be reproduced here because the firmware is not in the repository. The NID computation above only confirms the names, not the bodies.
  • The InventoryExports.hpp include of <streambuf> sits before the extern "C" block, which is correct; no other change to the header.

Sources

Not verified

  • The firmware bodies and RVAs cited in the PR (Ghidra on a local dump) were not checked; approval would depend on them, so I am withholding it.
  • The C++ test was not compiled or run here; its static_asserts and runtime checks are unverified on this head.
  • Hosted: linux, relinker and relinker-asan were skipped at this head, so no Linux test result exists.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728404235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14401#pullrequestreview-5728404235). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T13:59:57Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The two `showmanyc` exports return zero without touching the buffer, which is what the base `std::basic_streambuf::showmanyc` contract specifies, and their NIDs match the Itanium names of those two specializations; I am not approving because the firmware evidence for the function bodies is not checkable here. ## What I ran - Exact head `07857a0650086d3d972a77e62c3063c6ad9d575e`, base `b2620e56d1` (the PR base). - Environment: Linux, `/usr/bin/python3` 3.11.2, no build. - Precheck: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14401 --output-dir /dev/shm/reviewer-run/precheck/14401` - ABI audit by hand (the helper is absent from the head tree): `python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base b2620e56d1 --head 07857a0650086d3d972a77e62c3063c6ad9d575e --json` (exit 0; `passed`; 0 findings). - NID identity computed with the repository's own function (`tools/nid_names.py`, `compute_nid`) for the Itanium names `_ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv` and `_ZNSt15basic_streambufIwSt11char_traitsIwEE9showmanycEv`: they give `IAEl1Ta7yVU` and `olsoiZsezkk`, the NIDs the exports carry. - Test-quality helper on `core/libs/tests/GuestLibcInternalShowmanyc.cpp` from a head extract: one literal-path registration heuristic; the test is registered in `core/libs/prx/libSceLibcInternal/CMakeLists.txt` with `${LIBS_INCLUDE_DIR}`. - Source read at head: `InventoryExports.cpp` (both exports), `include/InventoryExports.hpp` (the typed declarations), the CMake registration and the test. ## Results Precheck report, checks table, unedited (`/dev/shm/reviewer-run/precheck/14401/report.md`): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check b2620e56d114ef053f8b45433b1d48aff7ec37ba...07857a0650086d3d972a77e62c3063c6ad9d575e` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 07857a0650086d3d972a77e62c3063c6ad9d575e --title feat(libSceLibcInternal): implement zero-return showmanyc exports --body /dev/shm/reviewer-run/precheck/14401/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base b2620e56d114ef053f8b45433b1d48aff7ec37ba --head 07857a0650086d3d972a77e62c3063c6ad9d575e --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14401 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14401/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /dev/shm/reviewer-run/precheck/14401/head-07857a065008-1d05bca6/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14401/head-07857a065008-1d05bca6 --json core/libs/prx/libSceLibcInternal/CMakeLists.txt core/libs/prx/libSceLibcInternal/InventoryExports.cpp core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp core/libs/tests/GuestLibcInternalShowmanyc.cpp docs/dev/debt/libSceLibcInternal.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | Hosted at this head: `windows`, `conventions`, `library-portability` and `report` succeeded; `linux`, `relinker` and `relinker-asan` were skipped by the workflow; three earlier `conventions` runs were cancelled. ## Negative control Not run. On base the test would fail to compile: its two `static_assert`s compare the export types with the `int ()` declarations that base has, so the signature change is what the test checks. ## Findings **Blocking:** none. **Non-blocking:** - The Ghidra inspection of firmware 13.60 that the PR cites (RVAs `0x00092b30` and `0x000c2c80`, bodies `31 c0 c3`) cannot be reproduced here because the firmware is not in the repository. The NID computation above only confirms the names, not the bodies. - The `InventoryExports.hpp` include of `<streambuf>` sits before the `extern "C"` block, which is correct; no other change to the header. ## Sources - Exports and signatures at head: https://github.com/boykopovar/AnyPS5/blob/07857a0650086d3d972a77e62c3063c6ad9d575e/core/libs/prx/libSceLibcInternal/InventoryExports.cpp - Test at head: https://github.com/boykopovar/AnyPS5/blob/07857a0650086d3d972a77e62c3063c6ad9d575e/core/libs/tests/GuestLibcInternalShowmanyc.cpp ## Not verified - The firmware bodies and RVAs cited in the PR (Ghidra on a local dump) were not checked; approval would depend on them, so I am withholding it. - The C++ test was not compiled or run here; its `static_assert`s and runtime checks are unverified on this head. - Hosted: `linux`, `relinker` and `relinker-asan` were skipped at this head, so no Linux test result exists.
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!14401
No description provided.