Repository navigation
feat(libkernel): read and set the GS base through sysarch - #7095
Merged
oneandonlydean merged 2 commits intoOct 17, 2026
Merged
Conversation
|
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.
|
10 tasks done
The Wine port (PPSA99995) ships an ntdll module that imports sysarch (b7uXQmnfB2s). libkernel did not export it, so loading stopped with "undefined symbol: b7uXQmnfB2s" before the title ran. Export sysarch as a stub that reports that it is not implemented: the title loads and runs its launcher without calling it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sysarch's AMD64_GET_FSBASE, AMD64_GET_GSBASE and AMD64_SET_GSBASE now follow FreeBSD 11's amd64 sysarch on Linux x86-64 through arch_prctl: the GS base is the calling thread's, a base at or above VM_MAXUSER_ADDRESS returns EINVAL and a null argument EFAULT. AMD64_SET_FSBASE, whose base guest and host code share for their TLS, other operations and other hosts still throw. Wine sets its TEB this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milescoviello
force-pushed
the
feat/sysarch-gsbase
branch
from
October 17, 2026 20:54
3bd56df to
d7c83db
Compare
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fb0f83d.
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 fix(libkernel): export sysarch so modules that import it load #6028's base.mainwith the PRs for its earlier stops merged locally: feat(libkernel): declare physhm_open and physhm_unlink #6915, fix(libkernel): export sysarch so modules that import it load #6028, fix(libSceSystemService): declare the PsmKit local process exports #6939, feat(libSceKeyboard): export missing firmware functions from database #6787, feat(libkernel): report the guest address-space map through kern.proc.vmmap #7070, fix(memory): honor low guest mapping hints #6469, feat(libkernel): pass descriptors in SCM_RIGHTS messages on Unix sockets #7090 and fix(libkernel): take NOTE_LOWAT on socket read and write events #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