feat(libc): implement libc++ base streambuf transfers #28655
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28655"
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 mihai1859 on 2026-12-02T14:50:36Z.
What
Implements
uflow,xsgetn, andxsputnon the base libc++basic_streambuf<char>class used by RetroArch Azahar in #5927.uflowcalls the guest'sunderflowvirtual, advances a readable buffered byte when possible, and otherwise returns the result ofunderflow. Bulk reads and writes use the available buffer before dispatching to the guest'sufloworoverflow. They check the cursor and destination before committing a buffered copy and return the completed byte count when a transfer range is inaccessible.The overlap tool flagged 14 CMake comparisons because those branches conflict with main. I checked each PR diff and confirmed the changes touch different source or test registrations.
Tested
Windows 11 x64, WinLibs GCC 16.2. Built the normal libc target and ran
guest_libcxx_streambuf_transferandguest_libc_static_imports. Both passed.Ran the original valid-buffer fixture against the corresponding machine code from PS5 Payload SDK v0.42 using a System V ABI bridge for its
memmovecalls. The fixture checks unsigned byte values, cursor updates, virtual dispatch, EOF, short writes, overlapping ranges, and nonpositive counts.Checked all three NIDs in the packaged
libc.prx. The Azahar startup diagnostic resolved all three target names and reported 150 unresolved imports (128 functions and 22 data symbols).Review update
7510c221515passedguest_libcxx_streambuf_transferandguest_libc_static_importson Windows. The new cases cover successful underflow with an empty, exhausted, or unreadable get area, partial transfers at a guard page, and read-only cursor storage. The packaged-library check still resolves all three Azahar imports.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T14:53:20Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: make
uflowhandle a non-EOF result whenunderflowdoes not establish a readable get area.What I ran
Reviewed head
2ae8cd0fd2c675fe99f30b3f84269f1d507a30c2using the prepared diff andrepo_read.py. No tests or builds were run.Results
Findings
Blocking
core/libs/prx/libc/src/LibcxxStreambufTransfer.cpp:58— Ifunderflowreturns a character without establishing a get area,uflowreads throughgetCurrentunconditionally. This can read an invalid address instead of returning the character supplied byunderflow. Preserve the non-EOF result and only consume a byte when the get area contains one. Pinned source.Non-blocking
None.
Not verified
The author reports Windows tests, a PS5 Payload SDK fixture run, and NID/startup checks; these were not independently run or confirmed. No changed files were excluded: reviewed
core/libs/prx/libc/CMakeLists.txt,core/libs/prx/libc/include/LibcxxStreambufTransfer.hpp,core/libs/prx/libc/libc.hpp,core/libs/prx/libc/src/LibcxxStreambufTransfer.cpp,core/libs/prx/libc/tests/cmake/guest_libcxx_streambuf_transfer.cmake,core/libs/tests/GuestLibcxxStreambufTransfer.cpp, anddocs/dev/debt/changes/feat-libc-streambuf-transfers.md.To get this to a good state
Update
uflowto return the non-EOFunderflowresult when there is no readable character in the get area, and consume the character only when the area contains one. Then rerun the reported transfer fixture and libc static imports test on the updated head.Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T14:57:48Z.
Review: COMMENTED
Actionable comments
13296fad-251a-41c1-8a6b-b78940173cf0Reviewing files that changed from the base of the PR and between
fc294cbbb5and2ae8cd0fd2.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/include/LibcxxStreambufTransfer.hppcore/libs/prx/libc/libc.hppcore/libs/prx/libc/src/LibcxxStreambufTransfer.cppcore/libs/prx/libc/tests/cmake/guest_libcxx_streambuf_transfer.cmakecore/libs/tests/GuestLibcxxStreambufTransfer.cppdocs/dev/debt/changes/feat-libc-streambuf-transfers.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T15:20:27Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
7510c221515fa17794b51268bf54686d4f723959by reading the prepared diff and all eight files listed underreviewed; no files were excluded. I did not run tests or builds.Results
Negative control
Not run; I did not execute the added test.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
I did not run the tests, build, or full Azahar execution. The author reports Windows 11 x64 test runs and packaged-library checks; those results were not independently verified. All eight files listed under
reviewedwere read;excludedis empty.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T15:23:59Z.
Review: COMMENTED
Actionable comments
3fc69c17-3eb6-4507-a834-8424a8cf29bdReviewing files that changed from the base of the PR and between
2ae8cd0fd2and7510c22151.core/libs/prx/libc/src/LibcxxStreambufTransfer.cppcore/libs/tests/GuardedBuffer.hppcore/libs/tests/GuestLibcxxStreambufTransfer.cppdocs/dev/debt/changes/feat-libc-streambuf-transfers.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T02:08:59Z.
Review: COMMENTED
The bundled streambuf transfer fixture passed in a standalone Linux run. I reproduced a buffered-path crash when host-read preparation invalidates the source after the preliminary readability check.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T13:51:26Z.
Review: APPROVED
Reviewed — looks good
The change at head
e2c4063fcc79ba5e694f41bd78350c0a153b3f1dwas reviewed across all eight changed files; I found no verified defects, and did not run tests.What I ran
Reviewed the prepared diff and all files listed as reviewed in the manifest, then used
repo_read.pyto inspect targeted source context. Review environment: read-only; no build or test commands were run. The author reports Windows tests and SDK checks in the PR description; those were not run by me.Results
Negative control
Not run; no executable test was run.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
I did not run the reported Windows tests, check the packaged library, or confirm behavior in Azahar on a physical console. No files were excluded by the manifest.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T13:54:09Z.
Review: COMMENTED
Actionable comments
05e4fbaf-2b8d-4a76-b1e2-47c577900c66Reviewing files that changed from the base of the PR and between
7510c22151ande2c4063fcc.core/libs/prx/libc/src/LibcxxStreambufTransfer.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:46:12Z.
Review: COMMENTED
The buffered copy now prepares the source before checking readability, addressing the ordering issue from my previous review.
guest_libcxx_streambuf_transferpassed on Linux with this head applied to6c6b29320f. Could the fixture also cover a source whose readability changes during the preparation hook so the fixed ordering stays exercised?Source review at
e2c4063fcc. The exact head trial-merges onto700fae9438.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T01:29:12Z.
Review: COMMENTED
Actionable comments
01b03733-1500-4e64-8022-57c8cabd3047Reviewing files that changed from the base of the PR and between
e2c4063fccand77e0b00753.core/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/libc.hppcore/libs/tests/GuardedBuffer.hppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T02:13:38Z.
Review: APPROVED
Reviewed — looks good
The implementation and its tests are consistent with the described streambuf transfer behavior; I found no blocking defects at head
77e0b00753058b621c3c9741011ed5d0655c1973.What I ran
Reviewed the prepared diff and all eight changed files at the pinned head. Base:
main; no merged-preview check was run. Environment: Linux review container; no build or tests were run.Results
Commands and output
No build or test command was run. The review used the prepared artifacts and targeted
repo_read.py searchandrepo_read.py catcalls; these were source inspections, not programmatic checks.Negative control
Could not run a negative control because no tests were run in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
The firmware provider’s compatibility and full Azahar execution were not verified. All eight files listed under
reviewedinfiles.jsonwere read;excludedis empty. The Windows test results in the PR description are author-reported and were not run in this review.To get this to a good state
No follow-up is required for this review.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.