Repository navigation
feat(ps5lift): add the runtime for lifted programs - #15798
oberonlift wants to merge 8 commits into
Conversation
✅ NVIDIA GPU test: passedPR head
Failing on main too (3, not counted against this PR)Validation IDs already present on main (13 IDs in 809 tests)Skipped (53)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
0dff559 to
7ba23a8
Compare
✅ AMD GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (13, not counted against this PR)Validation IDs already present on main (8 IDs in 809 tests)Skipped (62)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
7ba23a8 to
1cb899b
Compare
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Passed on retry (3, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validation IDs already present on main (9 IDs in 812 tests)Skipped (59)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
1cb899b to
91c5f5a
Compare
91c5f5a to
061d639
Compare
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Passed on retry (3, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validation IDs already present on main (9 IDs in 812 tests)Skipped (61)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
061d639 to
3b217ac
Compare
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (9 IDs in 819 tests)Skipped (61)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
3e6b160 to
c5283d2
Compare
The fenv functions read and write the x87 control, status and environment and MXCSR through GuestCpu's inline helpers, which issue the same x87 and SSE instructions, so a build for another host replaces them in one header. feholdexcept keeps the exceptions masked as the fnstenv it replaces did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceKernelReadTsc and the TSC frequency measurement read the counter through GuestCpu::ReadTsc, which is __rdtsc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spin loops in the driver yield through PreciseSpinPause, which is now defined on every platform and uses the aarch64 yield hint, and WriteChanged falls back to its byte loop on targets other than x86-64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able helpers The worker's spin timing reads the counter through GuestCpu::ReadTsc and pauses through PreciseSpinPause. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
webrtc's CPU feature query runs cpuid and xgetbv through new GuestCpu helpers, which issue the same instructions as <cpuid.h>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ps5lift's runtime is the library a lifted program links. It maps the guest images, dispatches indirect calls, lays out TLS as x86-64 does, runs x87 code on Berkeley SoftFloat, answers cpuid as the PS5's Zen 2, calls native functions through guest function pointers and back, and provides the GuestCpu functions, the guest FPU state and timestamp counter that AnyPS5's libraries read when they are built for a lifted guest. `tools/ps5lift.py runtime` builds it with SoftFloat, a new submodule, into a shared library for a target, and the program's main into an archive. Its known gaps are a ps5lift section of the technical debt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A workflow builds the runtime with LLVM 18 on GitHub's ubuntu-24.04-arm runner every night, on request, and for pull requests that change ps5lift or the workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GuestCpuCpuid and GuestCpuXgetbv give a library built for a lifted guest the PS5's answers that lifted code gets from cpuid and xgetbv, so it can pick the code paths the guest CPU supports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c5283d2 to
1867566
Compare
Merge after #15797. Until it merges, this PR also shows #15797's changes; oberonlift#18 shows only this PR's 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 2 of 8 PRs that let AnyPS5's libraries run a lifted program; the lifter itself follows them. The runtime does not need #15797; this branch is stacked on it.
What
ps5lift's runtime is the library a lifted program links, and the one AnyPS5's libraries link when they are built for a lifted program.
ps5lift/runtime): maps the guest images at their link addresses, dispatches indirect calls, lays out TLS as x86-64 does, runs x87 code on Berkeley SoftFloat, answerscpuidandxgetbvas the PS5's Zen 2, and calls native functions through guest function pointers and back.GuestCpu*functions, which the later PRs call underANYPS5_GUEST_LIFTED: the guest's MXCSR and x87 state, x87 extended-precision arithmetic, the timestamp counter,cpuidandxgetbv, calls into guest code and interrupted contexts, guest stacks and fibers, unwinding, and the program's images and their symbols.State.handBridge.hppare the headers lifted code and the generated import bridges build against.tools/ps5lift.py runtimebuilds it with SoftFloat, a new submodule, into a shared library for a target and CPU, and the program'smaininto an archive. The CPU is the one the lifted code targets,neoverse-v2on aarch64 unless--cpunames another, so the runtime needs no feature the program doesn't; a library older than any of its objects is linked again.ps5lift/or the workflow.Tested
On a DGX Spark (aarch64 Linux, NVIDIA GB10, LLVM 18),
tools/ps5lift.py runtimebuilds the runtime foraarch64-unknown-linux-gnu. The later PRs exercise it: with all eight PRs and ps5lift on top: every library builds for a lifted program, 2,288 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