feat(libc): implement __umodti3 #4462
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4462"
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 milescoviello on 2026-10-12T12:28:13Z.
What
Fixes #4460. Carries @screamm's fix branch from that issue (
screamm:feat/libc-umodti3,2d3ac3d5), keeping the commit and its authorship, as the issue invites.libc lacks
__umodti3(NIDELSr5qm4K1M). Kart PS5 (PPSA99611) stops on it right after__divti3(#4037 reports the stop), and PS5CEMU-HAR (PPSA99360) imports it too. The division loop ofSonyUdivti3moves into a sharedSonyUdivmod128helper that returns the quotient and the remainder;SonyUdivti3behaves as before andSonyUmodti3returns the remainder, as compiler-rt'sumodti3.cdoes. A zero divisor throws and names the dividend, as__udivti3throws. The export sits in libc beside__udivti3, sincelibSceLibcInternalimports fall back tolibc.prx. A TechnicalDebt entry sits beside the__udivti3one.Since the branch was cut, #4037 (
__divti3) merged and touched the same two spots, as the issue expected. I resolved the conflict when cherry-picking:SonyCrt.hppkeepsSonyDivti3after the new helpers (it callsSonyUdivti3), and inGuestCrt.cppthe new cases follow the__divti3ones, with theirmaximumrenamed tounsignedMaximumbecause__divti3's tests already declare amaximumin the same scope. Nothing else changed.Tested
guest_crt3/3 and 606/606 ofctest -E "^agc_driver_|^video_out_flip".mainfb23e85f.guest_crtpasses, and withmain'sSonyCrt.hppandRuntimeSupport.cppit does not build (the export does not exist there). All 304guest_*tests pass.FAIL: unresolved ELF import ELSr5qm4K1M from libc.prxonmain, gets past it and stops atgacfOmO8hNs(ceil).tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)__divti3, verified by the title run above; I found no Game bring-up discussion for it🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T12:29:30Z.
Progress report (
104bb65→23ac439)➖ System libraries: 86.25% (+0.0%, +1 implemented functions)
✅ 1 implemented
__umodti3_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T13:00:42Z.
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.
main)core/libs/prx/libc/src/RuntimeSupport.cppL190