fix(libkernel): export sysarch so modules that import it load #6028
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6028"
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-14T19:38:32Z.
What
The Wine port (PPSA99995,
prospero-win) does not start onmain:Update (10-15): since #5559 (merged 11:38), Linux and macOS defer a runtime-only module such as
ntdlluntil a module that needs it is used. Onmain940eba9a2the title starts on Linux without this PR: its launcher, with an empty game library, does not loadntdllin a 40 s run (LD_DEBUG=files), so the error above no longer appears there. #5559 keeps eager loading on Windows, so there the load should still stop at this import (not checked here). On Linux, the import would only be resolved oncentdllis loaded, which my runs don't reach.b7uXQmnfB2sissysarch(tools/nid_names.py --nid b7uXQmnfB2s), the FreeBSD call that gets and sets the FS and GS bases. Itsntdllmodule imports it, and libkernel does not export it, so loading stops before the title runs.libkernel now exports
sysarchas a stub that reports that it is not implemented, next to the other unimplemented exports inUnimplemented.cpp. With it the title loads and runs its launcher, and it does not callsysarchin a 125 s run. An implementation would have to set the GS base througharch_prctlon Linux and could not on Windows or macOS, where the host owns that register, so that waits for a title that calls it.guest_sysarchchecks that the call reportssysarch not implemented. Without the export it does not link.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
main9f03c4fe0, then rebased ontomain358e218a4:guest_*tests pass,guest_sysarchincluded.--to-inteland run on Linux for 40 s; the builds differ only inlibkernel.prx:main: exits with 127 at 0 s on the error above./data/prospero-win/logs/session-0.log) records the keyboard and mouse modules opening, the data mount, an empty game library and the launcher's state (launcher video=state pad=ok hid=ok frame=1 apps=0).tools/check_conventions.py --base upstream/mainpasses, andtools/pr_overlap.py --branchfinds no overlap.@screamm checked it on Windows (RTX 4070, WinLibs GCC 15.2.0), alone and stacked with #6102 and #6135 on
main5d9dcc42d. Windows still bindsntdll's imports at load. With #6102 and #6135 but without this PR, Prospero Win (PPSA99995) exits within 1 to 3 s onFAIL: unresolved ELF import b7uXQmnfB2s from libkernel.prx, 2 of 2. With all three, 2 of 2 runs reach the 125 s limit at its launcher's library screen, with no stop line.guest_sysarchpasses 3 of 3 and fails both negative controls. Of 1,093 relinked import registries from 51 titles, only PPSA99995 importssysarch.Not checked on a console.
Follow-up (10-17): #7095 builds on this PR and implements the GS base operations (
AMD64_SET_GSBASE,AMD64_GET_GSBASE,AMD64_GET_FSBASE), because Forever Launcher's Wine (PPSA99030) now callssysarch(AMD64_SET_GSBASE, ...)for its TEB. This PR stays the declaration that lets the modules load.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-14T19:39:19Z.
Progress report (
90fcd20→162f4af)📉 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-15T12:13:37Z.
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/libkernel/Unimplemented.cppL12Some 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.
core/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/Unimplemented.cppcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-16T08:24:11Z.
Cross-validation on Windows of head
fb0f83ddf, alone and stacked with #6102 (f1735f59f) and #6135 (10bc2f05a), on main5d9dcc42d. My earlier run of this PR was at183782ddc(posted in #6135);fb0f83ddfis the same commit rebased (git range-diffshows patch and message unchanged).Windows 11 Pro 26220, Ryzen 7 5700X, NVIDIA RTX 4070 (596.21), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release.
-k 0on the stack: onlyagc_driver_gpu_indirect_arguments_misaligned_writer_ahead_testsfails (the 64 KiBalignasthat also fails onmain, #6452/#6478);libsbuilds; no warnings in the changed files.guest_sysarch,--repeat until-fail:3: 3 of 3.Unimplemented.cppas onmainthe test does not link (undefined reference to 'sysarch'); with only theNotImplemented_nid_no_patchcall removed it fails withsysarch returned instead of reporting that it is not implemented.libs:libkernel.prx1646 -> 1647 (onlyb7uXQmnfB2sadded), 62614 -> 62615 in total. Of 1093 relinked import registries of 51 local titles, only PPSA99995 importsb7uXQmnfB2s(ntdll.prxandwow64native.prx).-j8 --timeout 120 -E '^agc_driver_|^video_out_flip'): 837 of 840 pass, 2 skipped,hardware_oracle_comparetimed out under load and passes alone (11.2 s).tools/check_conventions.py --base origin/mainandgit diff --check: pass.Prospero Win (PPSA99995),
--trap-sdk-syscall-stubs --module-dir win/wine/lib/wine/x86_64-unix, display on, 125 s limit. This answers the "not checked on Windows" point: Windows still bindsntdll's imports at load.main, andmain+ this PR alone: conversion stops atFAIL: Unsupported Windows guest TLS instruction (bytes: 65 48 8b 0c 25 78 03 00 00) (offset 0x3214c)(that is #6102's part).0xC0000139after 1-3 s, 0 frames:b7uXQmnfB2slines are gone; only the fourlibSceVideoOut.prxcursor imports remain.not implemented. The window shows the launcher's library screen ("NO APPLICATION PROFILES FOUND"), andsession-0.loghaslauncher video=ok pad=ok hid=ok frame=1 apps=0. So the launcher does not callsysarchin that time.Suggestion: "Unblocks: none" could become "PPSA99995 on Windows, with #6102 and #6135", since that is where the stop line moves.
Not checked: Linux, a console, any program run inside Prospero Win.
Written with Claude Code assistance (validation by a subagent, reviewed in this session).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T08:29:53Z.
Thanks @screamm, that answers the Windows question properly. Your results are in the description, and "Unblocks" now names Prospero Win on Windows with #6102 and #6135.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T22:19:21Z.
@adriadam10 FYI: this landed through #7095, which carried this PR's commit fb0f83ddf, so GitHub now shows it as merged. I've added myself as co-assignee for the follow-up; you're still on it as before.