libkernel: the JIT shared memory calls are absent (VLC, XPSemu, RetroArch); fix branch ready #3736
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 screamm on 2026-10-11T16:12:16Z.
libkernel lacks
sceKernelJitCreateSharedMemory(avvJ3J0H0EY),sceKernelJitCreateAliasOfSharedMemory(MR221Mwo0Pc) andsceKernelJitMapSharedMemory(YKT49TOLQWs). From the relink registry order they are the next predicted stops of VLC (PPSA85300, 452/462, aftergetdtablesize), XPSemu (PPSA97358, 398/399) and RetroArch (476 to 478); not yet observed in a run. The titles' own sources (VLC and XPSemups5/compat/mmap.c, RetroArch's platform probeCreate("ps5-platform-probe", 0x10000, 7, &fd),Alias(fd, 3, &out),Map(fd, 5, &addr)) fall back on any non-zero return, so a throw would be worse than a documented error.Branch ready:
screamm:feat/libkernel-jit-shared-memory(one commit onmaina11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.tools/ida/db_types.json, ps4sdkinclude/sce/kernel.hand ps5-jar-loaderLibKernel.java(all agree on the out-pointer form of Alias; SharpProspero's by-value Alias was not followed). NewDirectMemory/Jit.cpp: Create makes a host anonymous file (memfdon Linux, a delete-on-close temporary file with aPAGE_EXECUTE_READWRITEsection on Windows) and returns a descriptor; Alias duplicates the descriptor with its own maximum protection; Map maps the whole object through the direct-memory placement path (*startOutas a hint likemmapwithoutMAP_FIXED), so a write through one view is visible through every other.close,sceKernelClose,dupanddup2keep the JIT descriptor table in step.EINVALfor a zero or non-16 KiB-multiple length, protection bits outside 0x7 or a null output pointer;EACCESfor an alias or map asking more than the descriptor's maximum (FreeBSDvm_map_protect);EBADFfor a non-JIT descriptor (includingshm_openones); host exhaustion asENOMEM/EMFILE/ENFILE. Choices no source settles (the 16 KiB rule,EACCES, the ignored name, no flexible-memory accounting,mprotectnot capped, nommapof these descriptors) are recorded in TechnicalDebt.guest_jit_shared_memorymaps an RW alias and an RX view, writesmov eax, imm; retthrough one and executes it through the other at two offsets, maps a single RWX view at a hint and runs code there, checks the object survives closing the creating descriptor anddup, and covers every error case.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs:guest_jit_shared_memory,guest_shm_open,guest_memory,guest_dup,guest_kernel_fcntl3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"534/537, the failures being the knownwindows_exceptions(#3411, fixed by #3415),guest_kernel_sys(#3510) andguest_filesystem(#3518); the negative check is inconclusive because the implementation file is new (the test is compiled into its own executable and cannot run againstmain);tools/check_conventions.py --base mainandgit diff --checkpass. The Linux path (memfd,MFD_EXECwith anEINVALfallback) is not built or run.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T16:37:54Z.
Linux run of the branch (799e048b, on
maina11c8f7f), Ubuntu 24.04, GCC 13, Release, in the repo's build container:guest_jit_shared_memory,guest_shm_open,guest_memory,guest_dupandguest_kernel_fcntlpass 5/5 (--repeat until-fail:5). The JIT test runs all its cases here, including executing the code through the RX and RWX views, so thememfdpath works.-Wformat-overflowinsceKernelOpen(Open.cpp) shows up onmainas well.check_conventions.py --base mainpasses.The static import audit on
mainagrees:sceKernelJitCreateSharedMemoryandsceKernelJitMapSharedMemoryare absent imports of VLC, XPSemu and RetroArch, andsceKernelJitCreateAliasOfSharedMemoryof RetroArch only. None of them is a first stop onmainyet. Once one of these titles reaches them I'm happy to carry the branch with your commit as is, unless someone else gets there first.