Repository navigation
feat(libc): add std::system_category and keep error_code values at offset 4 - #9014
Conversation
…ffset 4 The console error_code and error_condition keep the value in the second dword: the shared error_category::equivalent reads it at +4, the default_error_condition overrides return it shifted into the high half, and title code built against the SDK headers stores 0 at +0 and reads value() at +4. The generic category returned and compared the value at +0. system_category returns a static _System_error_category named "system" that shares the generic message table and maps a value with a message to the generic category in default_error_condition. The equivalent overloads are shared by both categories and go through the object's own default_error_condition, as the console's base implementation does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
|
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.
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.
|
|
Overlap notes for the reports above:
🤖 Generated with Claude Code |
|
Correction: I mislabelled the firmware. The decrypted modules I read are firmware 13.60, not 12.00 (each module's module-param segment records SDK 13.60). The behaviour described is unchanged; only the version label was wrong. I've updated the description. Assisted With AI: Yes But all test done locally on actual hardware |
|
Checked every use of |
What
Adds
std::system_category()(aotaAaQK6yc) and moves theerror_code/error_conditionvalue to byte offset 4, where the console keeps it.PPSA29340's eboot imports
system_category. So do the SDK modules shipped with PPSA08427. In PPSA29340 the call comes from itsstd::filesystemcode: it builds anerror_codeby writing 0 to +0 and the category to +8, readsvalue()at +4, and compares the category pointer withsystem_category()(around eboot0xaa7a5a–0xaa7b2f).Behaviour from the decrypted PS5 13.60
libSceLibcInternal:error_codelayouterror_category::equivalent(const error_code&, int)(0x1b760) compares the value at +4 and the category at +8. Bothdefault_error_conditionoverrides (0x1b710, 0x1bba0) return the value shifted into the high half of the first qword.system_errorstores the code as those two qwordsErrorCodeis{reserved, value, category}; the condition overrides return{0, value, category}system_category()(0x1b6e0)_System_error_categoryname(0x1bb00)"system"message(0x1bb10)"unknown error"fallback as the genericmessage(0x1b900)default_error_condition(0x1bba0)_Syserror_map's tableequivalent(int, const error_condition&)(0x1b730)default_error_conditionand compares the resultSt22_System_error_category, deriving fromSt14error_categoryThe deleting destructor throws, as the generic one already does on
main. The code is written from the observed behaviour; nothing from the module is copied.Not changed here:
mainuses 95 and 96. It also has 1040, 1050, 1051 and 1074, whichmainlacks. I'll send that as a separate PR.__sce_v2::system_errorwas not assessed. It is built differently (libc++-style). My feat(libc): add the std::__sce_v2 exception types and throwers #8901 still writes the old two-fieldErrorCode, so whichever of the two lands second gets adjusted.iostream_categorystill returns the host library's object.Tested
Linux (CachyOS, GCC, Release).
guest_generic_categorynow also checks:name;value << 32;equivalentoverloads go through the system mapping;The generic condition is also checked for the reserved dword and for
equivalent.GuestAmprCppError.cppandGuestAmprThreads.cppreadsystem_error::codethrough their own copies of the layout, and both copies now match it.The 552 tests matching
guest_|libc|ampr|exceptionall pass. Each negative control fails the test:equivalentcomparing against the object itself instead of its condition ("line 71").tools/check_conventions.pyis clean. No open PR exportssystem_categoryunder its name or NID. Three-way merges with the open PRs touching these files: #6044, #7201, #8658 and #8901 each gain one or two conflicting hunks inStandardExceptions.cpp; the others merge cleanly.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)system_category; neither was run with this change🤖 Generated with Claude Code
https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK