feat(libkernel): read and set the GS base through sysarch #7095
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7095"
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-17T11:16:38Z.
What
#6028 exports
sysarchas a throwing declaration so modules that import it load. Forever Launcher's Wine (PPSA99030) now calls it:amd64_set_gsbase(sysarch(AMD64_SET_GSBASE, &base)) to point GS at its TEB. This PR implements the three operations that are safe here, following FreeBSD 11's amd64sysarch, on Linux x86-64 hosts through the host'sarch_prctl:AMD64_SET_GSBASE(131) sets the calling thread's GS base. A base at or above0x800000000000(VM_MAXUSER_ADDRESS) returnsEINVAL, and a null argument returnsEFAULT. Nothing on the host side uses GS on Linux x86-64.AMD64_GET_GSBASE(130) andAMD64_GET_FSBASE(128) copy the base out, with the sameEFAULT.AMD64_SET_FSBASE: guest and host code share the thread's FS base for their TLS.The implementation moves from
Unimplemented.cpptoSystem/src/Process.cpp, anddocs/dev/debt/libkernel.mdgets an entry.Tested
Ubuntu 24.04, GCC 13.3, Release, on #6028's head fb0f83ddf5.
guest_sysarchnow checks the operations on Linux x86-64:AMD64_GET_GSBASEand through%gs:0. The FS base read back equals%fs:0's self pointer.0x800000000000returnsEINVALand leaves the base unchanged, and null arguments returnEFAULT.AMD64_SET_FSBASE) and operation 7 throw.ctest -R '^guest_|libc': 383 of 383 pass, on #6028's base.mainwith the PRs for its earlier stops merged locally: #6915, #6028, #6939, #6787, #7070, #6469, #7090 and #7092.sysarch not implemented, 2 of 2.failed to open "C:\\windows\\system32\\wineboot.exe"and exits withSTATUS_DLL_NOT_FOUND. The launcher says the prefix "must be initialized by payload Wine", a separate payload that isn't part of the title, and its UI keeps running.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
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T11:17:21Z.
Progress report (
3e83446→d7c83db)📉 System libraries: 89.62% (-0.03%, +1 declared functions)
🆕 1 declared as stubs
sysarchImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T11:27:34Z.
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.
docs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/System/src/Process.cppdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/System/src/Process.cppdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/System/src/Process.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/System/src/Process.cppdocs/dev/debt/libkernel.md