feat(libc): implement __divti3 #4037
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4037"
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 Nixitov on 2026-10-11T21:56:54Z.
What
Implement the guest
__divti3(__int128signed division) export in libc, alongside the existing__udivti3. Kart PS5 (PPSA99611) importsXU4yLKvcDh0(__divti3) and stops at start-up onmain:With this change the title gets past it and stops at its next missing import,
ELSr5qm4K1M(__umodti3).SonyDivti3divides the operands' magnitudes throughSonyUdivti3and gives the quotient the sign of the operands, i.e. truncation toward zero as the compiler runtime does. A zero divisor throws, as__udivti3does;INT128_MIN / -1wraps toINT128_MIN.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
guest_crtpasses:cmake --build build --target libc guest_crt_tests && ctest --test-dir build -R "^guest_crt$".Phi1ow/mkwii-ps5releasev1.0.0-rc1, assetKart-PS5.zip),eboot.binunwrapped from its SELF and relinked with the built relinker--windows: onmainit stops atFAIL: unresolved ELF import XU4yLKvcDh0 from libc.prx; with this change it passes__divti3and stops atELSr5qm4K1M(__umodti3).python tools/check_conventions.py --base origin/mainpasses.maindoes not buildlibkernelon Windows (Socket.cpp: 'HostPoll' was not declared in this scope), unrelated to this change; the runs above usedmainwith #4021 applied. This PR does not depend on #4021.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)