Repository navigation
Conversation
PS4 programs load system libraries with sceKernelLoadStartModule and their console path. The OpenOrbis piglet sample loads /<sandbox word>/common/lib/libScePigletv2VSH.sprx and libScePrecompiledShaders.sprx, the sandboxed form of /system/common/lib/ that sceKernelGetFsSandboxRandomWord names. The path was opened as a guest file and the load failed with ENOENT. A path in /system/common/lib/ or in the sandboxed /<word>/common/lib/ whose file name ends in .sprx now loads the host libs/<name>.prx, as libSceSysmodule does for module IDs. Names with a directory part are not mapped, so such a path cannot leave libs/.
PS4 titles ship sce_sys/param.sfo instead of param.json. When param.json is absent, the application metadata now reads the title, title ID, download data size and user defined parameters from param.sfo, and /data and /download0 are mounted for it as for param.json. param.json is still preferred when both files exist.
PS4 titles built with Sony's toolchain place a switch statement's jump
table in the code segment, after the last instruction of the function
that indexes it and inside the function's unwind range:
lea rcx, [rip + table]
movsxd rax, dword ptr [rcx + rax*4]
add rax, rcx
jmp rax
Code analysis decodes each function range from start to end, so it read
the table as instructions; the syscall scan and the call-site resolver
sweep the whole segment and lost their instruction boundaries there.
Limbo (CUSA01664) stopped at "Unsupported Windows guest TLS instruction
(bytes: 65 f9)" and Bloodborne (CUSA00900) at "Instruction exceeds 15
bytes".
FindInlineJumpTables decodes a function range, follows the table
address of each RIP-relative lea through 64-bit register moves, and
records the address a movsxd with scale 4 indexes when it lies later
in the same function. When decoding reaches the first such address and
every dword from there to the end of the function is an offset, from
the nearest table before it, to code before the first table, the rest
of the function is taken as tables. Anything else is decoded as before.
Code analysis stops each function there and keeps the control-flow
pass out of the tables; the pipeline fills them with nops in the copies
the syscall scan and the call-site resolver read.
# Conflicts: # core/relinker/relinker/src/guest/GuestImageReader.cpp
# Conflicts: # docs/dev/debt/libkernel.md
# Conflicts: # docs/dev/debt/relinker.md
# Conflicts: # docs/dev/debt/libkernel.md
…ction symbol Limbo's bundled libSceFios2.prx (CUSA01664) has DTPMOD64 relocations against a local section symbol of value 0. As for a TLS relocation without a symbol, the module and offset are the module's own TLS block, so such a relocation is passed on without its symbol; a section symbol with a value, or a module without PT_TLS, still fails.
Each GCN instruction is re-encoded to its RDNA form and decoded by the existing RDNA decoder, so the PS4 path shares the recompiler. Covers the legacy VS stage (program at the VS slot, user SGPRs from s0, vertex and instance index in v0-v3), fetch shaders linked as user-data calls, MIMG (image_sample and friends), PS4 buffer descriptors (GCN DATA_FORMAT / NUM_FORMAT, 44-bit base) and T# image descriptors (GCN tiling in word 7). The GCN switch is keyed into the shader disk cache. PS5 behaviour is unchanged: every PS4-only rule is gated on GcnGuestShaders().
PS4 color and depth targets, buffer and image descriptors and the PS4 tile modes (1D/2D thin and display, depth with tile split, PRT, linear general) on the AGC executor, with a GPU detiler for every mode. Textures sampled over the padded corner of a render target are GPU block copies, and the PS4 SDK pattern-fill compute kernel runs as a GPU fill (render targets and HTILE are cleared without a CPU drain), so Limbo holds 60 fps. Tests cover the tiling equations against addrlib formulas, the GPU detiler for every mode and element size, descriptors and fills.
Real sceGnm shader, state and draw packet writers, submit and submit-and-flip into the AGC executor, PS4 sync packets lowered to their PS5 forms, constant engine buffers merged into the draw buffer and the PS4 graphics EOP event. VideoOut accepts the PS4 10-bit display format.
NpTrophy reads the trophy count and icons from the title's trophy package (names are encrypted and stay not implemented), PS4 v1 save data calls wrap the native v2/v3 ones, NpWebApi library contexts, handles and push event filters work offline (service filters fail without a signed-in user), sceNpSetContentRestriction validates and stores. libSceAjm is built from the libSceAjm.native sources for PS4 titles, and Limbo's remaining imports are exported as not implemented.
…gain Running Limbo's two-dword clears of its 64-bit target as buffer fills made its gameplay advance about half as far per frame as with the kernel (same input, same save), although the stored values are equal. Only single-dword patterns are filled again until the cause is known.
Each GCN instruction is re-encoded to its RDNA form and decoded by the existing RDNA decoder, so the PS4 path shares the recompiler. Covers the legacy VS stage (program at the VS slot, user SGPRs from s0, vertex and instance index in v0-v3), fetch shaders linked as user-data calls, MIMG (image_sample and friends), PS4 buffer descriptors (GCN DATA_FORMAT / NUM_FORMAT, 44-bit base) and T# image descriptors (GCN tiling in word 7). The GCN switch is keyed into the shader disk cache. PS5 behaviour is unchanged: every PS4-only rule is gated on GcnGuestShaders().
The SOPK branch of the GCN decoder never set the literal for s_setreg_imm32_b32, so the eight-byte instruction was re-encoded as one word and its decode threw "literal operand word is out of the code span bounds". The decoder now copies the literal for that opcode; the new agc_gcn_decode test decodes the reported stream. Co-authored-by: javierUDP <35921725+javierUDP@users.noreply.github.com> Co-authored-by: Savvanis Spyros <savvaniss@yahoo.gr>
PS4 color and depth targets, PS4 graphics EOP events, and the PS4 tile modes (1D/2D thin and display, depth with tile split, PRT, linear general) on the AGC executor, with a GPU detiler for every mode. Textures sampled over the padded corner of a render target are GPU block copies, and the PS4 SDK pattern-fill compute kernel runs as a GPU fill when it repeats one dword, so render targets and HTILE are cleared without a CPU drain. Two-dword patterns keep running the kernel: as fills, Limbo's clears of its 64-bit target made its gameplay advance about half as far per frame. Tests cover the tiling equations against addrlib formulas, the GPU detiler for every mode and element size, and the fill ranges.
Real sceGnm shader, state and draw packet writers, submit and submit-and-flip into the AGC executor, PS4 sync packets lowered to their PS5 forms, constant engine buffers merged into the draw buffer and the PS4 graphics EOP event. VideoOut keeps the pitch of tiled PS4 display buffers and accepts the PS4 10-bit display format. The four tool-state queries (submissions allowed, user PA, GPU capture, Razor) are silent stubs listed in the debt file.
…imports NpTrophy reads the trophy count and icons from the title's trophy package (names are encrypted and stay not implemented), PS4 v1 save data calls wrap the native v2/v3 ones, NpWebApi library contexts, handles and push event filters work offline (service filters fail without a signed-in user), sceNpSetContentRestriction validates and stores. libSceAjm is built from the libSceAjm.native sources for PS4 titles. Limbo's (CUSA01664) remaining PS4 imports, including the synchronous PS4 TUS calls and the Facebook dialog calls next to the existing libraries, are exported as not implemented.
…cb540 The branch is now main cecb540 with ps4/relinker-own-tls, ps4/gnm-driver (which carries ps4/gcn-shaders and ps4/agc-gcn) and ps4/limbo-libs merged. The pull requests it carried before have merged into main; the old history is kept as the first parent so pull requests against this branch keep their base.
sceNpSetContentRestriction, which Limbo calls at start; ps4/limbo-libs no longer implements it.
…integration branch
…ntegration branch boykopovar#9429, boykopovar#9433 and boykopovar#9225 are merged into main, so the branch is now main 7e2ba73 with boykopovar#9430 to boykopovar#9432. The merge keeps the earlier history as a parent so the pull requests opened against this branch keep their base.
|
Merging this pull request would not change |
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.
What
Draft integration branch: PS4 titles on the AGC driver, with Limbo (CUSA01664) in game. This branch is
mainwith the pull requests below merged, so they can be tested together. It isn't meant to merge itself: the members merge one by one, each with its own review, and the branch is rebased down as they land. Details, how to run and the bring-up story are in boykopovar#6978.libSceGnmDriverand VideoOutsceNpSetContentRestriction, which Limbo calls at startWith A, E and boykopovar#9225 in
main, the branch is nowmain7e2ba73 plus boykopovar#9430 to boykopovar#9432, taken in with a merge commit so the pull requests other contributors opened against it (Get-fix#1 to boykopovar#21) keep their base. Those join the table once each is open upstream with its own review; ntamas94's boykopovar#9671 to boykopovar#9676 already are, on top of boykopovar#9430 to boykopovar#9432.Tested
On
main7e2ba73 with boykopovar#9430 to boykopovar#9432, Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88):main. The 3 that fail also fail onmain7e2ba73 on this machine:agc_driver_sample_orderand its--grid-referenceand--recipe-depth-locationscases.mainagainst the branch with the same focused tests: the same 50VUID-errors in the same 8 existing PS5 tests, none added (details in feat(libSceGnmDriver): build PS4 command buffers and submit them boykopovar/AnyPS5#9432).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