feat(libc): export std::__sce_v2::_Syserror_map_search #11421

Merged
edubox merged 1 commit from upstream-pr/11421 into main 2026-11-08 09:47:27 +00:00
edubox commented 2026-10-26 12:48:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-10-26T12:48:25Z.


What

Exports std::__sce_v2::_Syserror_map_search(int) (a9DvgsV9dWw) and makes the versioned std::__sce_v2::_Syserror_map(int) use the same table.

The console libc.prx in PPSA02530 and PPSA28416 exports _Syserror_map_search at 0xce8b0 / 0xcfb50 (41 bytes). It walks 79 16-byte records, compares the int at offset 0 and returns the pointer at offset 8; the fallback is null. The record pointers are RELA relocations, so resolving them from the bundled module gives the 79 strings, including entry 0 {0, "success"} and the Sony codes 107, 108, 1040, 1050, 1051 and 1074. Codes 35 and 45 occur twice and the first record wins.

The versioned _Syserror_map (4ITMYcbipA0, 0xce870, 57 bytes) is the same loop with "unknown error" as the fallback. Before this change AnyPS5 used the shared FreeBSD list, which has no Sony codes and maps 95/96, which are not in the console's versioned table. Both versioned functions now share the console table; the unversioned _Syserror_map is unchanged.

Tested

Linux x86-64, GCC 16.2.1, Release, BUILD_TESTING=ON.

  • guest_sce_v2_exceptions and guest_generic_category pass.
  • python3 tools/check_conventions.py --base origin/main and git diff --check pass.
  • Not tested with a title: PPSA28416 stops at sceNpGetSandboxInfo before these imports are reached. No Windows product run; the hosted product jobs are skipped by path policy.

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 (PPSA28416 has no Game bring-up discussion)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5017675112 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11421). Originally posted by [edubox](https://github.com/edubox) on 2026-10-26T12:48:25Z. --- ### What Exports `std::__sce_v2::_Syserror_map_search(int)` (`a9DvgsV9dWw`) and makes the versioned `std::__sce_v2::_Syserror_map(int)` use the same table. The console `libc.prx` in PPSA02530 and PPSA28416 exports `_Syserror_map_search` at `0xce8b0` / `0xcfb50` (41 bytes). It walks 79 16-byte records, compares the `int` at offset 0 and returns the pointer at offset 8; the fallback is null. The record pointers are RELA relocations, so resolving them from the bundled module gives the 79 strings, including entry 0 `{0, "success"}` and the Sony codes 107, 108, 1040, 1050, 1051 and 1074. Codes 35 and 45 occur twice and the first record wins. The versioned `_Syserror_map` (`4ITMYcbipA0`, `0xce870`, 57 bytes) is the same loop with `"unknown error"` as the fallback. Before this change AnyPS5 used the shared FreeBSD list, which has no Sony codes and maps 95/96, which are not in the console's versioned table. Both versioned functions now share the console table; the unversioned `_Syserror_map` is unchanged. ### Tested Linux x86-64, GCC 16.2.1, Release, `BUILD_TESTING=ON`. - `guest_sce_v2_exceptions` and `guest_generic_category` pass. - `python3 tools/check_conventions.py --base origin/main` and `git diff --check` pass. - Not tested with a title: PPSA28416 stops at `sceNpGetSandboxInfo` before these imports are reached. No Windows product run; the hosted product jobs are skipped by path policy. ### 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](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: none - [x] Fixes: none - [x] Unblocks: none (PPSA28416 has no Game bring-up discussion) - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-26 13:01:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T13:01:26Z.

Review: DISMISSED


I completed the source review and the implementation matches the supplied binary analysis: _Syserror_map_search returns null for misses, while versioned _Syserror_map preserves the unknown error fallback; selected tests cover Sony codes, duplicate-code order and the unchanged unversioned map. The stated symbol NID checks with tools/nid_names.py. I found no source defect in this patch.

The remaining merge blocker is the repository branch rule: this head is based on 2db37cf1de, while current main is 035ac96edd (17 commits ahead). The intervening commits do not touch the changed implementation or test files and the merge preview is clean. Please sync to current main and rerun conventions. Eligibility, conventions, intake, labels, report, Ubuntu relinker/ASan/register-context and the Windows relinker now pass; macOS relinker, register-context and write-watch jobs remain pending. The Linux focused test result in the PR description is author-reported, not independently run here.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5652364246 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11421#pullrequestreview-5652364246). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T13:01:26Z. **Review:** DISMISSED --- I completed the source review and the implementation matches the supplied binary analysis: `_Syserror_map_search` returns null for misses, while versioned `_Syserror_map` preserves the `unknown error` fallback; selected tests cover Sony codes, duplicate-code order and the unchanged unversioned map. The stated symbol NID checks with `tools/nid_names.py`. I found no source defect in this patch. The remaining merge blocker is the repository branch rule: this head is based on `2db37cf1de`, while current `main` is `035ac96edd` (17 commits ahead). The intervening commits do not touch the changed implementation or test files and the merge preview is clean. Please sync to current `main` and rerun conventions. Eligibility, conventions, intake, labels, report, Ubuntu relinker/ASan/register-context and the Windows relinker now pass; macOS relinker, register-context and write-watch jobs remain pending. The Linux focused test result in the PR description is author-reported, not independently run here.
MarcZX10 commented 2026-10-29 09:05:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:05:36Z.

Review: APPROVED


The prior source review found the new versioned error-map search behavior consistent with the referenced runtime and its tests cover the Sony codes, duplicate-code ordering, and unchanged unversioned map. The author has refreshed the branch through current main and reports focused tests, conventions and diff checks passing. I did not run them locally. No new source concern is visible in this rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695205755 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11421#pullrequestreview-5695205755). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:05:36Z. **Review:** APPROVED --- The prior source review found the new versioned error-map search behavior consistent with the referenced runtime and its tests cover the Sony codes, duplicate-code ordering, and unchanged unversioned map. The author has refreshed the branch through current main and reports focused tests, conventions and diff checks passing. I did not run them locally. No new source concern is visible in this rebase.
MarcZX10 commented 2026-10-30 06:53:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T06:53:23Z.

Review: APPROVED


Re-checked — looks good

I reviewed head 9f687728a12434730faa1fa95496c8f66a11a441 against recorded base 0839e8f3442331a951efe82b5ba700007bc36539; the three-file diff remains scoped to the versioned error-map export/table and focused tests. The hosted Windows product check passes and Linux was skipped; I ran no local C++ tests. I found no blocking issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5708995047 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11421#pullrequestreview-5708995047). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T06:53:23Z. **Review:** APPROVED --- # Re-checked — looks good I reviewed head `9f687728a12434730faa1fa95496c8f66a11a441` against recorded base `0839e8f3442331a951efe82b5ba700007bc36539`; the three-file diff remains scoped to the versioned error-map export/table and focused tests. The hosted Windows product check passes and Linux was skipped; I ran no local C++ tests. I found no blocking issue.
gabichuuuuu commented 2026-11-08 03:54:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T03:54:42Z.

Review: COMMENTED


Ran 6a949964f8 merged on main 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), the Windows side the description leaves out: ctest -R '^guest_sce_v2_exceptions$' passed three times out of three. main passes too, and main plus only this PR's GuestSceV2Exceptions.cpp doesn't build (_ZNSt8__sce_v220_Syserror_map_searchEi_nid_postfix was not declared), so the new checks only hold with the new export.

On Windows that covers:

  • the five Sony codes (1040, 1050, 1051, 1074 and 0);
  • the first-match order for the duplicated 45 and 35;
  • 95 and 99999 giving null from _Syserror_map_search and "unknown error" from _Syserror_map;
  • the existing lines on main (_Syserror_map(2) still matches the unversioned _Syserror_map, _Syserror_map(0) is still "success").

From reading:

  • The table has the 79 records the description gives, in the same order, and both versioned functions now share it.
  • The only other callers of std::__sce_v2::_Syserror_map on main are those test lines, so dropping 95 and 96 from the versioned map changes nothing else in the tree.
  • The unversioned std::_Syserror_map keeps the FreeBSD list.

The checks are green. The linux job is skipped on pull requests, so the Linux run in the description is the only Linux coverage.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5816503572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11421#pullrequestreview-5816503572). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T03:54:42Z. **Review:** COMMENTED --- Ran `6a949964f8` merged on `main` 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), the Windows side the description leaves out: `ctest -R '^guest_sce_v2_exceptions$'` passed three times out of three. `main` passes too, and `main` plus only this PR's `GuestSceV2Exceptions.cpp` doesn't build (`_ZNSt8__sce_v220_Syserror_map_searchEi_nid_postfix` was not declared), so the new checks only hold with the new export. On Windows that covers: - the five Sony codes (1040, 1050, 1051, 1074 and 0); - the first-match order for the duplicated 45 and 35; - 95 and 99999 giving null from `_Syserror_map_search` and "unknown error" from `_Syserror_map`; - the existing lines on `main` (`_Syserror_map(2)` still matches the unversioned `_Syserror_map`, `_Syserror_map(0)` is still "success"). From reading: - The table has the 79 records the description gives, in the same order, and both versioned functions now share it. - The only other callers of `std::__sce_v2::_Syserror_map` on `main` are those test lines, so dropping 95 and 96 from the versioned map changes nothing else in the tree. - The unversioned `std::_Syserror_map` keeps the FreeBSD list. The checks are green. The `linux` job is skipped on pull requests, so the Linux run in the description is the only Linux coverage. AI-assisted: yes.
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!11421
No description provided.