fix(libkernel): zero sceKernelWaitEqueue's count on every failure as firmware 13.42 does #15123
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15123"
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 BunnyFl on 2026-11-02T17:32:55Z.
What
sceKernelWaitEqueuenow stores 0 in the result count on every failure and rejects a non-positive event count before it looks at the queue, as firmware 13.42's does.Firmware 13.42's
sceKernelWaitEqueue(NIDfzyMKs9kim0,libkernel.sprxat0x1cf60, read from disassembly, not measured on a console):So every error return leaves
*out == 0. Onmain:*outgotSCE_KERNEL_ERROR_EBADF(0x80020009), because the internal wait result was stored before it was checked;*outunchanged;A null result pointer still returns
SCE_KERNEL_ERROR_EINVALwithout a store; the firmware stores to it unchecked. That divergence and the untested null-event-list case are listed under Functional indocs/dev/debt/libkernel.md.VerifyFailedWaitClearsCountinGuestEqueueEvents.cppchecks the result andcount == 0for counts 0 and −1, a null event list, a poll timeout, a deleted queue (with counts 2 and 0), and a queue deleted from another thread during a 1 s wait. #14680 adds return-code checks for the same calls to the same file; its expectations are unchanged by this PR.Tested
Windows 11, WinLibs MinGW-w64 GCC 15.2.0 (UCRT, POSIX threads),
BUILD_TESTING=ON.guest_equeue_eventspasses. Withmain'sEqueue.cppand this PR's test, it aborts (0xc0000409).sceKernelWaitEqueue(guest_ampr_tests,guest_http2_tests,guest_job_manager_failure_tests,guest_kernel_error_tests,guest_kqueue_tests,guest_socket_event_tests,guest_video_out_hdr_tests): 9 of 9 pass.libSceJobManagerwaits throughsceKernelWaitEqueueitself (Export.cpp:785), so I also ran every JobManager test (guest_job_manager_*,job_manager_compute_progress, andagc_driver_job_manager_compute*on the GPU): 31 of 31 pass.tools/check_conventions.py --base upstream/mainpasses;tools/pr_overlap.pyfinds no overlap.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