docs(libc): record feholdexcept, fegetexcept, setlocale and strcasecmp as measured on a PS5 #11121
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11121"
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 orezraey on 2026-10-25T18:42:29Z.
What
Four libc entries measured on a retail PS5 (firmware 13.60) against the system
libSceLibcInternal, with homebrew probes from a payload process. AnyPS5 already behaves as measured, so onlydocs/dev/debt/libc.mdchanges. The sources and console logs are in this gist (pfehold,pfeexcept,psetloc,pcasecmp).feholdexcept: the entry said console equivalence was unverified. On the console it saves the environment with its flags (the 28-byte x87fnstenvblock and MXCSR at offset 28 of the 32-bytefenv_t), masks the x87 exceptions keeping rounding and precision (0x0377 becomes 0x037f, 0x0a7f stays), clears the x87 status, sets MXCSR to(csr & ~0x3f) | 0x1f80(0x9bc1 and 0x8040 become 0x9fc0, 0xdfe0 becomes 0xdfc0) and returns 0, which is whatMath.cppdoes. A null argument faults there and throws here, which the entry keeps.fegetexcept: the entry asked whether the PS5 reads only the x87 masks when the units disagree. It does: MXCSR unmasked alone gives 0, the x87 unmasking DIVBYZERO alone gives 4, the x87 unmasking everything with SSE masked gives 0x3f, and DENORMAL (0x2) is reported. The gap is closed, so the entry is removed.feenableexceptandfedisableexceptchange both units and return~((cw | mxcsr >> 7) & 0x3f)(all masked 0xffffffc0, all unmasked 0xffffffff), whichFloatingPoint.cppalso returns; their Rosetta 2 entry is untouched.setlocale: the entry said the rule was not measured on a console. For categories -1 to 7, 100 and1 << 30, a null,""or"C"name gives "C";"POSIX","C.UTF-8","en_US.UTF-8","ja_JP","en_US.ISO8859-1"and"ISO8859-1"give null without settingerrno. This is the ruleStdioExtras.cppfollows, so the entry is removed. Thelocaleconventry said whethersetlocalechanges the table was not known; it now says it cannot.strcasecmpandstrncasecmp: the entry said console locale behaviour was unmeasured. The system library has only the C locale and returns -1, 0 or 1 with lower-case folding ("["against"a"and"_"against"A"give -1), no folding of high bytes ("\xe9"against"\xc9"gives 1,"\x7f"against"\x80"gives -1), andstrncasecmpwith n 0 gives 0. This matchesStrings.cpp, so the entry is removed.Tested
Documentation only. Head
258ce3e2e9onmaina7a2eece49.tools/check_conventions.pypasses; each changed entry is under 1000 characters.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)localeconventry this PR also edits; merge order only)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:50:43Z.
Review: APPROVED
Reviewed the documentation-only change against the linked firmware 13.60 probe logs and
Strings.cpp. ThelibSceLibcInternalrows show normalized -1/0/1 results forstrcasecmp, C-locale ASCII folding, unchanged high bytes, andstrncasecmpreturning 0 at n=0; these agree with the implementation. The separatelibc.prxSDK comparison in the logs has different raw-difference results, but the PR clearly scopes its claim tolibSceLibcInternal. Thefeholdexcept,fegetexcept, andsetlocaleclaims are also supported by their linked captures. The changed debt entries accurately distinguish measured console behavior from host behavior. The conventions, eligibility, intake, and labels checks pass; this is documentation-only and product test jobs are skipped.