feat(ps5lift): run lifted programs and titles on AnyPS5's libraries #15807

Closed
oberonlift wants to merge 40 commits from upstream-pr/15807 into main
oberonlift commented 2026-11-04 16:24:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oberonlift on 2026-11-04T16:24:18Z.


Merge after #15804 and #15806. Until the PRs before it merge, this PR also shows their changes; oberonlift/AnyPS5#16 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-preview merges 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 connects the lifter, #15806, to AnyPS5's libraries, which #15797, #15798 and #15799 to #15804 build for a lifted program, and takes a title from its files to a running game. With it, all of ps5lift is in.

What

  • Import bridges: tools/ps5lift.py bridges reads an AnyPS5 library's exports with libclang and writes a bridge per export, which takes the arguments from the guest's SysV registers and stack and calls the native implementation through its C prototype. Function-pointer parameters become thunks that call back into the guest, long double crosses between the guest's x87 format and the host's, and a variadic export calls its v sibling with a SysV va_list. For libc it writes 1532 bridges and leaves 27 exports, which it reports.
  • Tests: the test build builds AnyPS5's libraries with ANYPS5_GUEST_LIFTED and runs lifted guests against them: libc, C++ exception, libkernel, libSceFiber and module-loading fixtures at -O0 and -O2, AnyPS5's PS5-style import and TLS executables, and AnyPS5's own libc tests. A further test checks the bridges' classification of records against clang's lowering.
  • Titles: tools/ps5lift.py game unwraps and relinks an extracted title with AnyPS5's unwrap_self.py and relinker, generates the bridges for the libraries it imports, lifts it and links it with the runtime; tools/ps5lift.py run starts it with the title's files as app0.
  • CI: the workflow's lifter job also installs the libclang Python bindings and AnyPS5's build dependencies and checks out every submodule.
  • Documents: docs/dev/PS5LIFT.md says how to run a title, and the design and the ps5lift section of the technical debt cover the bridges and the lifted libraries.

Tested

On a DGX Spark (aarch64 Linux, NVIDIA GB10, LLVM 18), with all the other PRs: all 69 of ps5lift's tests pass, at each of this PR's two commits. EVO Player, a homebrew media player, lifts, links and runs to its home screen at 60 fps. As on #15806, the convention check passes with #15805's script and with main's reports only the system LLVM line until #15805 merges.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source; the bridge generator uses the system's libclang Python bindings
  • Generic behaviour, not specific to one title
  • Depends on: #15806, #15804
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GB10, driver 580.178.04, Ubuntu 24.04.5 (DGX OS)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5157739610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15807). Originally posted by [oberonlift](https://github.com/oberonlift) on 2026-11-04T16:24:18Z. --- **Merge after #15804 and #15806.** Until the PRs before it merge, this PR also shows their changes; oberonlift/AnyPS5#16 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-preview`](https://github.com/oberonlift/AnyPS5/tree/ps5lift-preview) merges all of its PRs ([how to try it](https://github.com/oberonlift/AnyPS5/blob/ps5lift-preview/PS5LIFT_PREVIEW.md)); native Apple Silicon support is coming along fast. It is a separate approach from the ARM64 compiler in #5021; #1835 has an introduction. This connects the lifter, #15806, to AnyPS5's libraries, which #15797, #15798 and #15799 to #15804 build for a lifted program, and takes a title from its files to a running game. With it, all of ps5lift is in. ### What - **Import bridges**: `tools/ps5lift.py bridges` reads an AnyPS5 library's exports with libclang and writes a bridge per export, which takes the arguments from the guest's SysV registers and stack and calls the native implementation through its C prototype. Function-pointer parameters become thunks that call back into the guest, `long double` crosses between the guest's x87 format and the host's, and a variadic export calls its `v` sibling with a SysV `va_list`. For libc it writes 1532 bridges and leaves 27 exports, which it reports. - **Tests**: the test build builds AnyPS5's libraries with `ANYPS5_GUEST_LIFTED` and runs lifted guests against them: libc, C++ exception, libkernel, libSceFiber and module-loading fixtures at -O0 and -O2, AnyPS5's PS5-style import and TLS executables, and AnyPS5's own libc tests. A further test checks the bridges' classification of records against clang's lowering. - **Titles**: `tools/ps5lift.py game` unwraps and relinks an extracted title with AnyPS5's `unwrap_self.py` and relinker, generates the bridges for the libraries it imports, lifts it and links it with the runtime; `tools/ps5lift.py run` starts it with the title's files as `app0`. - **CI**: the workflow's `lifter` job also installs the libclang Python bindings and AnyPS5's build dependencies and checks out every submodule. - **Documents**: `docs/dev/PS5LIFT.md` says how to run a title, and the design and the ps5lift section of the technical debt cover the bridges and the lifted libraries. ### Tested On a DGX Spark (aarch64 Linux, NVIDIA GB10, LLVM 18), with all the other PRs: all 69 of ps5lift's tests pass, at each of this PR's two commits. EVO Player, a homebrew media player, lifts, links and runs to its home screen at 60 fps. As on #15806, the convention check passes with #15805's script and with `main`'s reports only the system LLVM line until #15805 merges. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source; the bridge generator uses the system's libclang Python bindings - [x] Generic behaviour, not specific to one title - [x] Depends on: #15806, #15804 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GB10, driver 580.178.04, Ubuntu 24.04.5 (DGX OS) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15807
No description provided.