Repository navigation
feat(libkernel): run threads for a lifted guest - #13
Open
oberonlift wants to merge 5 commits into
Open
oberonlift wants to merge 5 commits into
oberonlift wants to merge 5 commits into
Conversation
12 tasks done
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 1, 2026 19:35
68aea15 to
2c7c036
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 1, 2026 19:35
dd078f7 to
25277c9
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 1, 2026 22:07
2c7c036 to
b7eea78
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
2 times, most recently
from
November 2, 2026 17:02
61186a9 to
319ad33
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
2 times, most recently
from
November 2, 2026 18:30
2c34c7a to
a1cc1f9
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 2, 2026 18:30
319ad33 to
65a7b9f
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 2, 2026 22:07
a1cc1f9 to
84e7323
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 2, 2026 22:07
65a7b9f to
8337a07
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 3, 2026 16:34
84e7323 to
e405a49
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 3, 2026 16:34
8337a07 to
6623bb0
Compare
Owner
Author
Review findings (unverified)Code review of
|
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 4, 2026 15:40
6623bb0 to
b6bc70b
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 4, 2026 15:40
e405a49 to
3e77693
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 4, 2026 16:20
b6bc70b to
c1e6f6a
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 4, 2026 16:20
3e77693 to
c9c7bc4
Compare
12 tasks done
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 4, 2026 17:17
c9c7bc4 to
093bf45
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
2 times, most recently
from
November 4, 2026 20:18
2a44260 to
c0cdf08
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
2 times, most recently
from
November 5, 2026 01:21
524b8de to
3bf0e50
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 5, 2026 01:21
c0cdf08 to
4b21d14
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 5, 2026 15:34
3bf0e50 to
a68d0af
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 5, 2026 15:34
4b21d14 to
48368e2
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 5, 2026 19:28
a68d0af to
3bee83c
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 5, 2026 19:28
48368e2 to
44fc211
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 6, 2026 00:18
3bee83c to
ccbc82d
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 6, 2026 00:18
44fc211 to
bafaa1c
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 6, 2026 15:35
ccbc82d to
e3c107e
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 6, 2026 15:35
bafaa1c to
744c658
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 6, 2026 17:39
e3c107e to
e1e808c
Compare
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 6, 2026 17:39
744c658 to
2190ab5
Compare
Call guest thread entries and exception handlers through GuestCpu, and leave out the x86 assembly for sigsetjmp, siglongjmp, getcontext and their kin in lifted builds, where the runtime provides the jumps and context switching reports itself as not implemented. A handler raised on a lifted thread sees the guest registers of the thread's last call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bridge already turns the guest entry point into a native thunk, so a lifted build calls it directly instead of through a GuestCpu call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A lifted thread's guest frames lived on ps5lift's fixed 8 MiB stack while scePthreadCreate sized the host stack, which holds the lifted frames, from the guest's request and reported part of it as the thread's stack. The guest stack is now a guarded mapping of the size the guest asked for, which the thread hands to the runtime through GuestCpuUseStack before its entry runs and which scePthreadAttrGet reports, and the host stack is the size GuestCpuHostStackSize gives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A thread handle is the address of its PthreadPrivate, which came from the host heap. On the console it is the address of the thread's structure in the process's own memory. On an aarch64 host the host heap lies at 0xaaaa... and 0xffff..., outside anything the guest can address, and a library that prints a handle with %p and reads it back with base 0 saw a leading hex letter and threw where the console's handle starts with a digit. In lifted builds PthreadPrivate now comes from the guest heap, so every handle, those of adopted threads included, is a guest address. Direct builds keep the host heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ps5lift loads from a lifted image's read-only segments without ordering, which holds only while nothing writes them. In lifted builds DoMprotect reports the pages each protection change makes writable to GuestCpuMakingWritable_nid_no_patch, and the runtime stops the program when they overlap such a segment. A MAP_FIXED mapping over such a segment is not reported; the libkernel debt notes record it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oberonlift
force-pushed
the
lifted-libkernel
branch
from
November 6, 2026 20:43
2190ab5 to
df80f50
Compare
oberonlift
force-pushed
the
lifted-libc-long-double
branch
from
November 6, 2026 20:43
e1e808c to
9a4129d
Compare
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.
Open on AnyPS5 as boykopovar#15803; this copy follows it.
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 boykopovar#5021; boykopovar#1835 has an introduction.This is 7 of 8 PRs that let AnyPS5's libraries run a lifted program; the lifter itself follows them.
x86-64: behaviour unchanged. Thread objects stay on the host heap; the stack size arithmetic shared with lifted builds computes the same values.
What
GuestCpu, and a lifted thread entry, which the bridge already turned into a native thunk, is called directly. The x86 assembly forsigsetjmp,siglongjmp,getcontextand their kin is left out of lifted builds, where the runtime provides the jumps and context switching reports itself as not implemented.GuestCpuUseStackand reported byscePthreadAttrGet; the host stack is the sizeGuestCpuHostStackSizegives. The thread takes its guest stack and the console's x87 control word before it unblocks signals, so a signal raised at a new or suspended thread runs its handler on that guest stack.DoMprotectreports the pages each protection change makes writable toGuestCpuMakingWritable_nid_no_patch. ps5lift loads from read-only segments without ordering, and its runtime stops the program when such pages overlap one. AMAP_FIXEDmapping over such a segment is not reported yet.GuestCpuCallInterruptedand sees the guest registers thatGuestCpuInterruptedContextreports; the signal-delivery assembly is left out of lifted builds.sceKernelWaitOnAddressreads a misaligned value with a plain copy followed by an acquire fence instead of x86'smov.EnterGuestMainStackcalls the guest entry on the stack the runtime gave the main thread, instead of switching to a main stack at the console's address.MAP_FIXEDgap, the host stack that the main and adopted threads report, and the zerofpstate,csandssan exception handler reads.boykopovar#5021 also changes some of the same files:
Thread.cpp,Pthread.hpp,Exception.cpp,SignalSets.cpp,DirectMemory.cpp.Tested
Compiled for x86-64 Linux before and after this PR (GCC 13, same flags): 153 of the 155 objects it reaches are byte-identical;
Thread.cppdiffers inscePthreadCreate's register allocation and a line-number constant, andException.cppin two line-number constants.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,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