Commit Graph
15 Commits
Author SHA1 Message Date
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
orezraeyandClaude Opus 5.5 aebed518a7 Merge main into fix/libkernel-aio-limits-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-23 17:27:35 -03:00
orezraeyandClaude Opus 5.5 eebb009302 fix(libkernel): report AIO states as a PS5 does after the first read
Measured on firmware 13.60: the first poll or wait that reports a
finished request returns its plain state and later ones add bit
0x10000, while cancel returns the plain state and does not count as a
read; a request that fails completes with state 3 and the error in its
result, and the other requests of its batch still run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 16:57:51 -03:00
orezraeyandClaude Opus 5.5 581a951db8 fix(libkernel): answer unknown AIO ids with ESRCH states as a PS5 does
Measured on firmware 13.60: an id that is not a live request, including
one already deleted, makes poll, wait, cancel and delete return 0 and
write 0x80020003 for it; delete makes an id unknown, and cancel leaves a
finished request's state unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 16:57:51 -03:00
orezraeyandClaude Opus 5.5 2730b6abe5 fix(libkernel): match the AIO batch, priority and parameter limits to PS5
Measured on firmware 13.60: submits take 1 to 128 requests at priority
1 to 3, the id lists of poll, wait, cancel and delete take 1 to 128 ids,
wait takes mode 1 or 2, and sceKernelAioSetParam takes a window and a
delayed count of 0 to 128, a split flag of 0 or 1 and, with split on,
split and chunk sizes of 1 to 0x1000000; everything else returns EINVAL
without writing. sceKernelAioInitializeParam writes the console's three
default scheduling structs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 16:57:51 -03:00
Evrim Cicek ad7e1acdb6 fix(libkernel): append positioned writes on an O_APPEND descriptor on Windows
On Windows, sceKernelPwrite, pwrite, sceKernelPwritev, pwritev and the AIO
write commands wrote at the given offset on a descriptor opened with
O_APPEND. FreeBSD's vn_write sets IO_APPEND for an O_APPEND regular file
whether or not an offset is given, the filesystem then writes at the end of
the file, and the file offset is left unchanged. Write at Windows'
end-of-file offset in that case, and gather a multi-buffer pwritev into one
write as writev already does.
2026-10-20 13:55:58 +03:00
valenciana-nc 767ea1ea0f fix(libkernel): check the AIO Multiple batch limit before reading the requests 2026-10-18 19:04:54 -06:00
PrintOrb 4680a52c1e fix(libkernel): return positioned descriptor errors without CRT reports 2026-10-11 18:35:17 -05:00
David 60a7f28112 feat(libkernel): implement sceKernelAioSetParam
Dying Light 2 (PPSA02262) imports sceKernelAioSetParam (9WK-vhNXimw) from
its eboot. In #1794 tv7 reported on main b5f5362d3 + #2129 (2026-10-10):

  FAIL: unresolved ELF import -q-vbO859Tw from libSceVideoOut.prx

with "12 other imports are still unresolved on `main`. In the eboot,
`-q-vbO859Tw`, `GTfJ64qFCPw`, `vwtVpHQKelI` (no known names),
`sceKernelAioSetParam` and `sceNpWebApi2GetMemoryPoolStats`." The import
is observed; its position in the loader queue after the nameless NIDs is
predicted.

The function fills one SceKernelAioSchedulingParam (five 4-byte fields,
20 bytes): Orbital cc408367 tools/ida/db_types.json:1103, SharpProspero
5dfdb4b0 Interop/Kernel/KernelAio.cs ("Sets every field of param at
once") and ampr_emu cfa85df3 ps5/include/sce/_fs.h agree on
(param, schedulingWindowSize, delayedCountLimit, enableSplit, splitSize,
splitChunkSize). No source gives an error code, so a null struct and
values outside SharpProspero's maximums (window and delayed count 0..128,
split flag 0 or 1, sizes up to 0x1000000) throw. The engine does not use
the settings, as sceKernelAioInitializeImpl ignores its struct; this is
recorded in TechnicalDebt.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit e45a2b950afe594212db2764529ccae32f84be8c)
2026-10-11 15:50:42 +00:00
erick-dsnk ace167a578 fix(libkernel): preserve EINVAL in AIO completions 2026-10-10 08:42:19 +02:00
Raihan Abdul MajidandClaude Opus 5.5 e768d97949 fix(kernel): keep the file offset in Windows AIO reads and writes
Each Windows AIO request is an overlapped ReadFile/WriteFile at the
request's offset, which on a synchronous handle also moves the
descriptor's file pointer; on the console AIO transfers leave it alone.
The requests now go through the positioned path sceKernelPread and
sceKernelPwrite use (NativePositioned in Stdio.cpp, exposed as
NativePositioned_nid_no_patch), which restores the pointer afterwards.
Negative offsets still fail with EINVAL before the transfer.

GuestAio sets the offset to 2 before a write batch and checks it is
still 2 after. TechnicalDebt records that a concurrent read or write on
the same descriptor can see the moved pointer in between, as for the
pread family.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
2026-10-10 00:22:22 +02:00
Ruzi 4f16f7c020 feat(libkernel): implement sceKernelAioPollRequests 2026-10-09 23:02:39 +03:30
clem-gbandClaude Opus 5.5 0fb192c4c3 fix(libkernel): use positioned transfers for Windows AIO requests
On Windows each AIO request seeked a _dup of the descriptor and then read
or wrote through it. A duplicated descriptor shares the file position, and
the seek and the transfer are separate calls, so two threads submitting
requests on one descriptor could transfer at each other's offset. Each
request is now a single ReadFile/WriteFile with an OVERLAPPED offset on
the OS handle, as pread and pwrite already do in Stdio.cpp.

GuestAio reads four distinct blocks of one descriptor from four threads
and checks every result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HeC9bA3n74TzJRYv9AgBE8
2026-10-08 10:47:32 +02:00
Adrià FranchandClaude 0f2699eef4 feat(libkernel): Aio batch submit, wait, cancel and delete
Co-Authored-By: Claude <[email protected]>
2026-10-06 08:11:07 +02:00
asimplestray c25c543f1c feat(kernel): implement Aio request lifecycle 2026-09-28 20:39:33 +00:00