Skip to content

feat(libc): forward the std::atomic wait and notify helpers to libkernel - #15561

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
Danigamer05:feat/libc-std-atomic-wait-20261103
Nov 10, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
Danigamer05:feat/libc-std-atomic-wait-20261103

Conversation

@Danigamer05

Copy link
Copy Markdown
Contributor

What

Add the four atomic wait and notify helpers that the libc.prx bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6) exports for std::atomic::wait and notify:

Export NID Original RVA
__std_atomic_wait_direct_32 kSLphkBuz6E 0x10EA60
__std_atomic_wait_direct_64 kzfKNNi3eew 0x10EAE0
__std_atomic_notify_one_direct dlNEq6BfzDk 0x10EB60
__std_atomic_notify_all_direct TpT-GpWLpEo 0x10EBA0

In that module they only forward to libkernel:

  • the waits call sceKernelSyncOnAddressWait32/Wait64 with the address, the expected value and the name SceLibcV2AtomicWait. A timeout of 0xffffffff milliseconds passes no timeout. Any other passes milliseconds × 1000 as microseconds, or 0xffffffff when the timeout is 0x418938 milliseconds or more, including values wider than 32 bits. They return 1 whatever libkernel returns;
  • the notifies call sceKernelSyncOnAddressWake with 1 or 0x7fffffff waiters.

libc cannot call libkernel directly, so this follows the FilesystemForwards pattern: AtomicWaitForwards.hpp declares the three calls, libkernel's SyncOnAddress registers them when it loads, and libc's AtomicWait.cpp uses them. A libc waiter and a libkernel waiter therefore share libkernel's wait queue. Without libkernel loaded, the helpers throw.

Tested

Windows x86-64, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, main 1e658521a0a. Exact tested commit: 8fca613fad7.

Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Progress report (ef9dc27 → f0e48f7)

📈 System libraries: 31.87% (+0.01%, +4 implemented functions)

✅ 4 implemented
Library Name
libc __std_atomic_notify_all_direct_nid_postfix
libc __std_atomic_notify_one_direct_nid_postfix
libc __std_atomic_wait_direct_32_nid_postfix
libc __std_atomic_wait_direct_64_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libc 1665/1687 (98.70%) 1669/1691 (98.70%) +0.0031%

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4563 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libc.md
PR 6149 core/libs/prx/libkernel/CMakeLists.txt
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
PR 7447 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 7544 docs/dev/debt/libc.md
PR 7715 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 8150 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 8965 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 9087 docs/dev/debt/libc.md
PR 9156 core/libs/prx/libkernel/CMakeLists.txt
PR 9293 core/libs/prx/libkernel/CMakeLists.txt
PR 9297 core/libs/prx/libkernel/CMakeLists.txt
PR 9302 core/libs/prx/libkernel/CMakeLists.txt
PR 9340 docs/dev/debt/libc.md
PR 9371 docs/dev/debt/libc.md
PR 9383 core/libs/prx/libkernel/CMakeLists.txt
PR 9389 core/libs/prx/libkernel/CMakeLists.txt
PR 9447 docs/dev/debt/libc.md
PR 9466 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 9526 docs/dev/debt/libc.md
PR 9557 core/libs/prx/libkernel/CMakeLists.txt
PR 9566 core/libs/prx/libkernel/CMakeLists.txt
PR 9938 core/libs/prx/libkernel/CMakeLists.txt
PR 10409 docs/dev/debt/libc.md
PR 10780 core/libs/prx/libc/include/Api.hpp
docs/dev/debt/libc.md
PR 11109 docs/dev/debt/libc.md
PR 11172 docs/dev/debt/libc.md
PR 11332 docs/dev/debt/libc.md
PR 11661 docs/dev/debt/libc.md
PR 11689 docs/dev/debt/libc.md
PR 11698 docs/dev/debt/libc.md
PR 11726 docs/dev/debt/libc.md
PR 11896 core/libs/prx/libkernel/CMakeLists.txt
PR 12682 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libc/include/Api.hpp
core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libc.md
PR 12688 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libc/include/Api.hpp
core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libc.md
PR 12700 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libc/include/Api.hpp
core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libc.md
PR 12717 core/libs/prx/libc/CMakeLists.txt
PR 12849 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 12965 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libc/include/Api.hpp
core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libc.md
PR 13449 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 13794 docs/dev/debt/libc.md
PR 13804 docs/dev/debt/libc.md
PR 14212 docs/dev/debt/libc.md
PR 16372 core/libs/prx/libkernel/CMakeLists.txt
PR 16862 docs/dev/debt/libc.md
PR 16964 core/libs/prx/libc/CMakeLists.txt
PR 17885 core/libs/prx/libkernel/CMakeLists.txt
PR 17897 core/libs/prx/libkernel/CMakeLists.txt
PR 17908 core/libs/prx/libkernel/CMakeLists.txt
PR 18074 core/libs/prx/libc/include/Api.hpp
docs/dev/debt/libc.md
PR 18135 core/libs/prx/libc/include/Api.hpp

@adriadam10 adriadam10 self-assigned this Nov 7, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JJenkx

JJenkx commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Windows check of head f0e48f70b4, merged onto main 4ab649f4d8 (d1dde6cfca, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_std_atomic_wait, guest_std_atomic_wait_kernel pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@adriadam10
adriadam10 merged commit 8356b8b into boykopovar:main Nov 10, 2026
20 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the forwarding to libkernel's sceKernelSyncOnAddressWait32/Wait64/Wake (name, ms→µs conversion and clamp, waiter counts, return 1), the registration pattern against FilesystemForwards, the ctest registration, and that both new tests pin values that fail without the change; CI green on the head; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants