feat: find a lifted program's guest images, load its modules and switch its fibers #15804
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15804"
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 oberonlift on 2026-11-04T16:24:08Z.
Merge after #15803. Until the PRs before it merge, this PR also shows their changes; oberonlift/AnyPS5#14 shows only its own.
ps5lift is a static recompiler for PS5 executables: it lifts a game's x86-64 code to LLVM IR and compiles it ahead of time to aarch64, which runs on Linux against AnyPS5's own libraries with no interpreter or JIT. It runs AnyPS5's PS5-style test programs and a homebrew media player to its home screen; commercial games are not playable yet. Branch
ps5lift-previewmerges all of its PRs (how to try it); native Apple Silicon support is coming along fast. It is a separate approach from the ARM64 compiler in #5021; #1835 has an introduction.This is 8 of 8 PRs that let AnyPS5's libraries run a lifted program; the lifter itself follows them.
x86-64: behaviour unchanged. The native module lifecycle runs through the state machine it now shares with lifted modules.
What
ps5lift's runtime maps a lifted program's executable and modules; the host's dynamic loader never sees them.
dlopenresolves the path as the native loader would and takes the lifted image whose path ends with it, or with it and.guest.prxappended, so a system library path still reaches AnyPS5's library when the title ships a module of the same name. It runs the module's lifecycle table through guest calls. Symbols come from that image's export table, anddlopen(NULL), whose handle is the executable's module ID, and the default scope search every image. A name that is not lifted still goes to the native loader; the lifecycle state machine is shared between the two paths.sceKernelGetModuleInfoFromAddr,sceKernelGetModuleInfoForUnwind,sceKernelGetModuleList, module info by handle,thread_atexit) find an image throughdl_iterate_phdrand identify it by the address of its first loadable segment, so a module's ID matches its load handle. Lifted images are never system images and are never unloaded.GuestCpu. Resuming a suspended fiber on a thread other than the one that started it throws, until each fiber has a guest state of its own.ps5lift/tests/lifted_tests.txtnames the 2,285 tests that pass with this PR, up from 101.#5021 also changes some of the same files:
DynamicLoader.cpp,ModuleInfo.cpp,Rtld.cpp.Tested
Compiled for x86-64 Linux before and after this PR (GCC 13, same flags): 154 of the 155 objects it reaches are byte-identical;
DynamicLoader.cppdiffers by the lifecycle it now shares with lifted modules.On a DGX Spark (aarch64 Linux, NVIDIA GB10, LLVM 18), with all eight PRs and ps5lift on top: every library builds for a lifted program, 2,285 of AnyPS5's own tests pass in that build on lavapipe, and ps5lift's 69 tests pass, among them its libc, exceptions, kernel, fiber and module-loading fixtures and upstream's libc test programs.
The conventions check passes on this branch.
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
Pull request closed