feat(libkernel_sys): implement scePthreadMain through pthread_main_np #10794

Merged
slopgobblercobbler merged 1 commit from upstream-pr/10794 into main 2026-10-26 01:27:17 +00:00
slopgobblercobbler commented 2026-10-25 01:30:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-10-25T01:30:46Z.


What

Implement scePthreadMain in libkernel_sys by forwarding to pthread_main_np_nid_postfix().
PR #9160 introduced IsInitialPthread_nid_no_patch() and implemented pthread_main_np. The corresponding SCE discovery export scePthreadMain was left throwing in Export.Discovery.cpp. Now that #9160 has merged into main, scePthreadMain forwards directly to pthread_main_np_nid_postfix(), and its discovery stub is removed.

The guest test GuestKernelSysThreads.cpp verifies scePthreadMain in both unpatched and patched modes alongside pthread_main_np for both the main thread and a worker thread.

Tested

  • Windows 11 x86_64: compiled ThreadQueries.cpp, Export.Discovery.cpp, and GuestKernelSysThreads.cpp with C++20 (-std=c++20).
  • Validated conventions with python tools/check_conventions.py --base upstream/main --head HEAD: 0 findings.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5000801952 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10794). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-10-25T01:30:46Z. --- ### What Implement scePthreadMain in libkernel_sys by forwarding to pthread_main_np_nid_postfix(). PR #9160 introduced IsInitialPthread_nid_no_patch() and implemented pthread_main_np. The corresponding SCE discovery export scePthreadMain was left throwing in Export.Discovery.cpp. Now that #9160 has merged into main, scePthreadMain forwards directly to pthread_main_np_nid_postfix(), and its discovery stub is removed. The guest test GuestKernelSysThreads.cpp verifies scePthreadMain in both unpatched and patched modes alongside pthread_main_np for both the main thread and a worker thread. ### Tested - Windows 11 x86_64: compiled ThreadQueries.cpp, Export.Discovery.cpp, and GuestKernelSysThreads.cpp with C++20 (-std=c++20). - Validated conventions with python tools/check_conventions.py --base upstream/main --head HEAD: 0 findings. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current main; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation .md files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 02:31:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T02:31:55Z.

Review: COMMENTED


The export forwards to the same initial-thread predicate as pthread_main_np, and the added cases check main-thread and worker-thread results in patched, unpatched, and worker-first loading paths. git diff --check and the current-main conventions check pass. Hosted eligibility, intake, labels, and report checks pass; product build/test jobs are skipped by path filters. The author reports compiling the changed sources on Windows 11; I did not run the guest executable locally, so I am leaving this as a comment rather than approving it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641182906 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10794#pullrequestreview-5641182906). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T02:31:55Z. **Review:** COMMENTED --- The export forwards to the same initial-thread predicate as `pthread_main_np`, and the added cases check main-thread and worker-thread results in patched, unpatched, and worker-first loading paths. `git diff --check` and the current-main conventions check pass. Hosted eligibility, intake, labels, and report checks pass; product build/test jobs are skipped by path filters. The author reports compiling the changed sources on Windows 11; I did not run the guest executable locally, so I am leaving this as a comment rather than approving it.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10794
No description provided.