Commit Graph
138 Commits
Author SHA1 Message Date
Adrià 1b55ee4ab3 Merge pull request #5610 from Dripl1x/codex/feat-libkernel-fixed-anonymous-mmap
feat(libkernel): support fixed anonymous mmap
2026-10-14 14:52:53 +02:00
Adrià 24f58e534a Merge pull request #5605 from babyhuey/feat/libkernel-soc-power
feat(libkernel): export sceKernelGetSocPowerConsumption
2026-10-14 14:51:36 +02:00
Adrià 4e0cb18d1e Merge pull request #5545 from Nixitov/feat/setpriority
feat(libkernel): implement setpriority
2026-10-14 14:46:16 +02:00
Adrià a628765e58 Merge pull request #5053 from YossiYad/feat/libkernel-mmap-regular-files
feat(libkernel): map regular files with mmap on Linux
2026-10-14 14:41:32 +02:00
Adrià 9a3e2ac4da Merge pull request #5187 from p3n1cillin/claude/getrlimit-nofile
feat(libkernel): report RLIMIT_NOFILE through getrlimit
2026-10-14 14:27:42 +02:00
Adrià aa6b757662 Merge pull request #4725 from akkadbakkad89/feat/kernel-page-table-stats
feat(libkernel): count committed ranges in sceKernelGetPageTableStats
2026-10-14 12:56:24 +02:00
Dean 318f237602 Merge pull request #5258 from JAB-dev/perf/unwind-info-cache
perf(libkernel): cache the unwind tables and image name per module on Windows
2026-10-14 22:39:58 +13:00
Dean 1a40d3d81f Merge pull request #5013 from p3n1cillin/claude/select-pipes
feat(libkernel): select on pipes on Windows
2026-10-14 22:39:38 +13:00
Dean Galvin 83a268a867 feat(libkernel): stop at start-up on a host CPU without the PS5's extensions
Titles run natively, so a host CPU without an extension that compiled Zen 2 code uses faults with an illegal instruction deep inside a title (#3719: SHLX, BMI2). libkernel now reads CPUID and XCR0 when it loads on Linux and Windows, logs the host CPU's extensions and throws, naming the CPU and the missing extensions, before any title code runs.
2026-10-14 20:29:57 +13:00
p3nicillinandClaude Opus 5.5 f288daf6fe feat(libkernel): select on pipes on Windows
select now checks pipe descriptors on Windows with the readiness test poll
already uses, so a pipe next to a libSceNet socket no longer throws.
RetroArch (PPSA99169) selects on libmicrohttpd's wake-up pipe beside its
listening socket. guest_select now runs on Windows too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 08:19:48 +01:00
p3nicillinandClaude Opus 5.5 1aaec9728d feat(libkernel): report RLIMIT_NOFILE through getrlimit
XPSemu (PPSA97358) queries RLIMIT_NOFILE at start-up in QEMU's
os_setup_limits and stopped on the unsupported resource. It reports the
descriptor count after which AnyPS5 fails with EMFILE: the C runtime's
8192 low-level descriptors on Windows and the host limit on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 08:12:33 +01:00
Dean f87799aa3a Merge pull request #5061 from p3n1cillin/claude/getdtablesize
feat(libkernel): add getdtablesize
2026-10-14 19:33:57 +13:00
Dean ea53213fd4 Merge pull request #4674 from zaydzaari/research/kernel-system-version-size-1342
fix(libkernel): accept measured system version record values
2026-10-14 19:06:34 +13:00
Yossi Yadgar 6b8ddfb5de docs(debt): note regular file mappings of mmap 2026-10-14 09:04:56 +03:00
JAB-devandClaude Sonnet 5.5 19c55dc804 fix(libkernel): drop the unwind cache's freshness check and let a failed forget throw
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 07:41:54 +02:00
akkadbakkad89 975ed1213d feat(libkernel): count committed ranges in sceKernelGetPageTableStats
Charge each recorded protection ranges 2 MiB granules to the gpu
pool when the range has GPU-access protection bits and to the cpu
pool otherwise, so the available counts reflect committed usage
instead of staying at the 2048-entry budget. Follows KytyPS5s
counting model.
2026-10-14 05:14:20 +00:00
Dean ee50655414 Merge pull request #5109 from pushkarreddyy/feat/libkernel-foreign-module-protect
feat(libkernel): support sceKernelMprotect on foreign guest module images on Windows
2026-10-14 17:26:42 +13:00
Dean 718ae1355c Merge pull request #4903 from ErenYeager1836/carry/fstat-guest-socket
fix(libkernel): report socket status from fstat on a guest socket
2026-10-14 17:26:23 +13:00
Dean a14ae8e232 Merge pull request #5186 from p3n1cillin/claude/carry-fioclex
fix(libkernel): handle FIOCLEX and FIONCLEX in ioctl
2026-10-14 16:31:08 +13:00
milescovielloandClaude Opus 5.5 472437a703 fix(libkernel): report socket status from fstat on a guest socket
fstat on a guest socket descriptor passed the guest number to the host,
which has no such descriptor, and threw ("FillFileStat: fstat failed for
fd 268435460"); sceKernelFstat returned EBADF. FreeBSD fills the stat
buffer for a socket through soo_stat (sys/kern/sys_socket.c):

	bzero((caddr_t)ub, sizeof (*ub));
	ub->st_mode = S_IFSOCK;
	...
	if ((sb->sb_state & SBS_CANTRCVMORE) == 0 || sbavail(sb))
		ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
	ub->st_size = sbavail(sb) - sb->sb_ctl;
	...
	if ((sb->sb_state & SBS_CANTSENDMORE) == 0)
		ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;

and pru_sense_null (sys/kern/uipc_socket.c) adds
st_blksize = so->so_snd.sb_hiwat.

fstat and sceKernelFstat now answer a guest socket from the socket
table: S_IFSOCK, the read bits until the receive side is shut down and
drained, the write bits until the send side is shut down, st_size from
the bytes queued and st_blksize from the send buffer size, other fields
zero. shutdown records which side it closed. A closed socket descriptor
returns EBADF. The differences from the console (peer shutdown, the
host's FIONREAD and SO_SNDBUF, socketpair identity) are listed in
TechnicalDebt.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 08:34:16 +05:30
Dean Galvin 46989a7d8a docs(libkernel): keep the memory protection bits entry 2026-10-14 16:00:06 +13:00
pushkarreddyy 516b06f945 feat(libkernel): support sceKernelMprotect on foreign guest module images on Windows 2026-10-14 08:19:25 +05:30
Dean 94f96c8e2c Merge pull request #5255 from Nesyth/fix/libkernel-apr-read-past-eof-v2
fix(libkernel): zero-fill APR reads that reach the end of the file
2026-10-14 15:44:14 +13:00
Dean 9b6555bd47 Merge pull request #4796 from xXPBSXx/feat/socket-options-sol-socket
fix(libkernel): report SO_ERROR and the other SOL_SOCKET options like FreeBSD
2026-10-14 15:37:41 +13:00
Nixitov afc04c73ad feat(libkernel): implement setpriority
PPSA50011 imports setpriority and stops at start-up once getpriority is implemented. Accept PRIO_PROCESS, PRIO_PGRP and PRIO_USER for the guest's own process and fail with ESRCH for any other id and EINVAL for any other which, leaving errno unchanged on success like FreeBSD's libc; the value is not applied, since the guest nice is not the host's scheduling class.
2026-10-14 04:27:54 +02:00
p3nicillinandClaude Opus 5.5 dad29cac43 feat(libkernel): report vm.overcommit through sysctlbyname
The mimalloc in PS5MC (PPSA99420) reads vm.overcommit at start-up and
stopped on the unsupported name. It reports FreeBSD's default, 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:44:48 +13:00
Dean dff25dd604 Merge pull request #5098 from p3n1cillin/claude/sysctl-hw-realmem
feat(libkernel): report hw.realmem through sysctl
2026-10-14 14:44:32 +13:00
Dean 8a51486bd2 Merge pull request #5393 from yixx16/fix/libkernel-vnode-windows-delete
fix(libkernel): keep the Windows vnode watch when the watched file is deleted
2026-10-14 14:25:11 +13:00
p3nicillinandClaude Opus 5.5 fe54938490 feat(libkernel): report hw.realmem through sysctl
The dolphin_libretro core of RetroArch (PPSA99169) reads {CTL_HW,
HW_REALMEM} as the machine's memory size and stopped on the unsupported
MIB. It reports the same value as hw.physmem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:23:55 +13:00
Dean fc1e388ed2 Merge pull request #5185 from p3n1cillin/claude/sysconf-clk-tck
feat(libkernel): report _SC_CLK_TCK through sysconf
2026-10-14 14:22:06 +13:00
Dean b16a1a72f3 Merge pull request #4776 from babyhuey/feat/libkernel-sysctl-tsc-freq
feat(libkernel): report machdep.tsc_freq from sysctlbyname
2026-10-14 14:09:31 +13:00
JAB-devandClaude Sonnet 5.5 434e0b9edf fix(libkernel): forget unwind images only when their module is unloaded and read tables outside the lock
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 02:49:16 +02:00
Evgeniy Kazarin 6215101d28 feat(libkernel): support fixed anonymous mmap
Map fixed private anonymous ranges through the existing guest arena. Preserve occupied ranges for MAP_EXCL and use FreeBSD 11.4 errors.

Cover replacement, exclusivity, range validation, rounding, and memory access.
2026-10-14 03:48:36 +03:00
babyhuey 31abd1a2af feat(libkernel): export sceKernelGetSocPowerConsumption 2026-10-13 20:32:24 -04:00
Adelmo Junior 12851ef037 docs: document flexible memory budget behavior 2026-10-13 20:13:14 -03:00
ducloc080202 3cab3c05ec fix(libkernel): use per-descriptor locks for positioned transfers and seeks 2026-10-14 11:18:07 +13:00
p3nicillinandClaude Opus 5.5 9be93156be feat(libkernel): add getdtablesize
VLC (PPSA85300) fails to load on the missing getdtablesize import now that
readdir_r is in. Its only call is in a spawn child that never runs, and the
console's descriptor limit is unknown, so the export throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 22:48:54 +01:00
David 1ba0a81820 feat(libkernel): implement getpriority for the guest process
PS5MC (PPSA99420, Kodi 22) imports getpriority (miQ1wVwSexE) from
libkernel.prx, one reference, next to chflags in its import order.
Predicted stop once the imports ahead of it are covered (not a run):

  FAIL: unresolved ELF import miQ1wVwSexE from libkernel.prx

The NID is computed with tools/nid_names.py and matches aerolib.

Follows FreeBSD 11.4 sys/kern/kern_resource.c sys_getpriority
(8c639945a44588f6cfdddfb057bb5aad88735da0) for the only guest process,
taken to run at nice 0 and to lead its own process group (as kill and
setsid already assume): PRIO_PROCESS and PRIO_PGRP with 0 or its pid,
and PRIO_USER with 0 or its uid 0, return 0; other ids give ESRCH and
an unknown which gives EINVAL. getpriority is a bare system call in
FreeBSD's libc (lib/libc/sys/Symbol.map), so errno is left unchanged
on success.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 63262245d274342b693fda146ae9feca3752b6e3)
2026-10-14 10:23:41 +13:00
Dean cf5f5b53b5 Merge pull request #4379 from MarcZX100/codex/carry-chflags-3632
feat(libkernel): carry chflags implementation
2026-10-14 10:22:02 +13:00
Dean 7d757bbf0a Merge pull request #4383 from pushkarreddyy/feat/libkernel-sigpending-sigsuspend
feat(libkernel): implement sigpending
2026-10-14 10:21:01 +13:00
Dean ea2b2d364f Merge pull request #4514 from kallmek3nny/feat/libkernel-pthread-setaffinity
feat(libkernel): implement pthread_setaffinity_np
2026-10-14 10:20:33 +13:00
JAB-devandClaude Sonnet 5.5 cf8c63b9b8 perf(libkernel): find a cached module's unwind tables without VirtualQuery on Windows
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 21:40:15 +02:00
MarcZX100 dfc9223248 docs(libkernel): retain chflags debt after rebase 2026-10-13 18:54:49 +00:00
David 4dd97f7dbe feat(libkernel): implement chflags through the guest path resolver
PS5MC (PPSA99420, Kodi 22) imports chflags (ixrw0h2tWuI) from
libkernel.prx, one reference. Predicted stop once the imports ahead of
it (pthread_getthreadid_np, sendfile, wcstok, pause, setrlimit and the
termios calls) are covered (not a run):

  FAIL: unresolved ELF import ixrw0h2tWuI from libkernel.prx

The NID is computed with tools/nid_names.py and matches aerolib.

Follows FreeBSD 11.4 (8c639945a44588f6cfdddfb057bb5aad88735da0)
sys/kern/vfs_syscalls.c kern_chflagsat and setfflags, and
sys/ufs/ufs/ufs_vnops.c ufs_setattr, for a root caller: the lookup
through the guest resolver gives EFAULT, ENOENT and ENOTDIR (also for a
file reached through a trailing slash or used as a directory), a bit
outside the 17 UFS flags of sys/sys/stat.h (VNOVAL included) gives
EOPNOTSUPP, and SF_SNAPSHOT gives EPERM, since the snapshot flag cannot
be toggled. No host keeps BSD file flags and stat reports st_flags 0,
so flags 0 succeed without touching the file and any other flag throws
with the flags named. UF_READONLY and the other Windows-attribute flags
are not mapped to FILE_ATTRIBUTE_READONLY and its siblings: UFS stores
them without enforcing them, and on Windows the read-only attribute is
already the owner write bit of chmod.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 16e5b7ccd04e6467a5a282b6cfc9271304f42244)
2026-10-13 18:54:05 +00:00
Jesus 50b06110bb fix(libkernel): keep the Windows vnode watch when the watched file is deleted
Windows 10 1903 deletes a file with open handles by moving it into
$Extend\$Deleted until the last handle closes, so the next snapshot of a
watched file that a title (or the test) deleted saw a new path, tried to
watch that directory's changes, got ERROR_ACCESS_DENIED and threw from
the watch thread, which aborts the process; the path change was also
reported as NOTE_RENAME next to NOTE_DELETE. A snapshot with a pending
delete or no links now reports NOTE_DELETE alone and drops the parent
directory watch instead of replacing it, as the file has no directory
to be renamed or removed from any more.
2026-10-13 13:41:05 -05:00
Dean 40047f46bd Merge pull request #4377 from MarcZX100/codex/carry-pthread-atfork-3628
feat(libkernel): implement pthread_atfork registration
2026-10-14 05:54:54 +13:00
screammandClaude Opus 5.5 74c3fb6576 feat(libkernel): implement pthread_setaffinity_np
PS5CEMU-HAR (PPSA99360, ps5-payload-dev build, relinks with
--trap-sdk-syscall-stubs) imports pthread_setaffinity_np (5KWrg7-ZqvE)
from libkernel.prx. babyhuey's run with #3787 merged onto main e7c70a2d
(PR #3787, 2026-10-12T10:54:44Z) stops at it:

  Windows: FAIL: unresolved ELF import 5KWrg7-ZqvE (pthread_setaffinity_np) from libkernel.prx
  Linux: undefined symbol: 5KWrg7-ZqvE (pthread_setaffinity_np)

It follows FreeBSD 11.4 libthr thr_affinity.c (8c639945) over
kern_cpuset_setaffinity: another thread is looked up first (EINVAL for
null, ESRCH when unknown or finished, as _thr_find_thread without dead
threads), a size other than the 32-byte cpuset_t returns ERANGE, the
mask is clipped to sceKernelGetAvailableCpumask and an empty result
returns EDEADLK, as cpuset_setaffinity does. The affinity is stored on
the guest thread through scePthreadSetaffinity, for the caller and for
any live guest thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 16:39:07 +00:00
JAB-devandClaude Sonnet 5.5 61ed25d9ed fix(libkernel): drop the cached unwind tables when the loader frees a module
The cache key of relinked images has no time stamp or check sum, so a
different module of the same size loaded at the same base was served the
old tables. The loader now forgets the image when it frees the module, the
cache has a separate valid flag, and the sysmodule name cache is left out
of this change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 18:13:12 +02:00
Adrià 3e8d0793b7 Merge pull request #4588 from Nixitov/feat/libkernel-host-hardware
feat(libkernel): report the host SoC and CPU temperature
2026-10-13 17:49:54 +02:00
Adrià 6679168360 Merge pull request #5210 from ErenYeager1836/carry/libkernel-coredump-user-file
feat(libkernel): answer the coredump user-file attach calls
2026-10-13 17:42:50 +02:00