feat(libSceLibcInternal): answer _Daysto, _FXp_getw and _Isdst as firmware 13.42 does #14945
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14945"
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 BunnyFl on 2026-11-02T03:05:24Z.
What
Three throwing libSceLibcInternal exports now do what firmware 13.42's module does. Each is a defined entry in its dynamic symbol table, and each is a leaf with no calls, syscalls or writable data:
int _Isdst()(Sb26PiOiFtE): returns -1 and reads no argument.int _Daysto(int year, int month)(ZlsoRa7pcuI): Dinkumware's days-to-start-of-month helper. The leap days beforeyearare(year - 1) / 4for a positive year,1 + (4 - year) / 4for a year of -4 or less, and 0 otherwise. To those it adds the entry formonthfrom the common table whenyear & 3is nonzero or the year is 0, and from the leap table otherwise. The module computes the leap days with 32-bit unsignedsubandshr, so4 - yearwraps for the five years fromINT_MINtoINT_MIN + 4; the implementation does the same instd::uint32_t(536870914 forINT_MIN, month 0). The module indexes the twelve-entry tables with anymonthand reads whatever follows them, so a month outside 0 to 11 throws here instead.float _FXp_getw(const float* parts, int count)(e1y7KVAySrY): Dinkumware's_Xp_getwforfloat, which sums the parts of an extended-precision value. 0 for no parts,parts[0]when there is one part or the first or second part is zero,parts[0] + parts[1]for two parts or a zero third part. Otherwiseparts[3]joinsparts[2]whencount >= 4, and the sum ishead + tailwhenhead - parts[0] == parts[1], elseparts[0] + (parts[1] + tail).Both month tables lie in a read-only segment and hold the usual cumulative days before each month (0, 31, 59, ... and 0, 31, 60, ...); they are written out in the code.
Source: firmware 13.42
libSceLibcInternal.sprx(sha256a01795ab49df639dd40abd6194956ada062244826824ce486c9acab227bf5285). Read to the return, disassembly only, not measured on a console.The pending lists in
docs/dev/debt/libSceLibcInternal.mddrop the three names, and a new entry records what stays unverified.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release, on upstream/main
93dbd0f82a:guest_libc_internal_firmware_answerspasses. It covers:_Isdst;_Daystofor years 1, 4, 5, 0, -1, -3, -4, -5, 100, 2023, 2024,INT_MINtoINT_MIN + 5andINT_MAX. The limit values come from the firmware's 32-bit arithmetic, computed independently. Built alone with-ftrapv, the first version's4 - yeartraps atINT_MIN(exit 3) and the current one returns 536870914;_FXp_getwpath, including two cases whereparts[1]is lost in the first sum, so the two final branches give different results ({2^24, 1, 1}gives 16777218, not 16777216), and a NaN first part._FXp_getwalways returninghead + tail, the test fails (a second part lost in the first sum is folded with the third first).public_headerspasses.python3 tools/check_conventions.py --base upstream/main: all checks pass.python3 tools/pr_overlap.py --branch feat/libcinternal-fw1342-daysto: no shared exports. The test registration sits in its own block at the end ofCMakeLists.txt, so this branch merges cleanly with #14401, which inserts at line 10. #5021 (the ARM64 compiler) and #14212 (debt-file reformatting) conflict with main and could not be compared. #14212 shows these names only as context lines in the debt lists.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)🤖 Generated with Claude Code