Skip to content

feat(libkernel): implement sceKernelGetProcessAbiType - #11939

Open
ionut27001 wants to merge 1 commit into
boykopovar:mainfrom
ionut27001:fix/libkernel-process-abi-type
Open

ionut27001 wants to merge 1 commit into
boykopovar:mainfrom
ionut27001:fix/libkernel-process-abi-type

Conversation

@ionut27001

@ionut27001 ionut27001 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements sceKernelGetProcessAbiType(int pid) in core/libs/prx/libkernel/System/src/Process.cpp and removes the throwing declaration from Unimplemented.cpp. The own pid and -1 return 1, pid 0 returns 0, and any other pid throws as unmodelled; the second argument is ignored here, and whether the export uses one is unknown. The debt entry says what is still open: other existing pids, which process pid 0 names, the meaning of the values, and a title process.

Measured in two payload process runs on a PS5 (firmware 12.70), p85 and p86 (E:/CLI/ps5-oracle/results/20261027T103808Z_p85_libkernel/result.log, E:/CLI/ps5-oracle/results/20261027T104816Z_p86_libkernel/result.log), result in rax:

  • own getpid() (108): 1 with a 16-byte 0xa5 buffer and with null as the second argument (p86 lines case abi_out pid=108 rax=0x1 buf=a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5, case abi_null pid=108 rax=0x1)
  • -1: 1 (p86 case abi_out pid=-1 rax=0x1 buf=a5a5..., case abi_null pid=-1 rax=0x1)
  • 0: 0 (p86 case abi_out pid=0 rax=0 buf=a5a5..., case abi_null pid=0 rax=0)
  • a stack pointer and an unspecified first argument: 0x80020003 (p85 v2 case abi_buf rax=0x80020003 buf=0000..., case abi_noarg rax=0x80020003)
  • in the three p86 abi_out cases the 16-byte 0xa5 buffer passed as the second argument was not written.

Other existing pids were not tried, so they throw here instead of returning SCE_KERNEL_ERROR_ESRCH, which was seen only for a stack pointer and an unspecified first argument (p85). PS5_MihawkOS (PPSA99170) imports this export.

Tested

Windows 11, WinLibs GCC 15.2.0 (Release, Ninja), commit 4fddc50 on main 75f3702 (the revert check below ran on ea35db574d, the same code on main 431a515):

  • ctest -R ^guest_process_abi_type$ passed twice.
  • With the function body (main's throwing stub with the new signature, since main declares no argument) restored from main and rebuilt, the same test aborts (sceKernelGetProcessAbiType not implemented).
  • Linux and macOS were not built or run.

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: feat(libkernel): implement pthread_mutex_getprioceiling and setprioceiling #9326 (only a docs/dev/debt/libkernel.md conflict; this lands after it and rebases)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor

Independent reviewer checks on exact head 3e3726d: Process.cpp and the new test translation unit both pass GCC 12 -std=c++20 -fsyntax-only -Werror; local conventions and git diff --check pass; the repository NID tool reproduces the existing export name/NID. The executable test was not built or run locally; the hosted Windows test is in progress. The runtime behavior is supported by the listed PS5 probe results, while other PIDs and title behavior remain explicitly unverified.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Progress report (75f3702 → 4fddc50)

📈 System libraries: 48.79% (+0.0074%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceKernelGetProcessAbiType

Changed libraries (implemented exports)

Library Before After Change
libkernel 692/737 (93.89%) 693/737 (94.03%) +0.14 pp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is supported by the measured own-pid, -1, and 0 cases; my local syntax, conventions, and NID checks pass. I found one contribution-rule blocker before approval: #9326 is open and changes the same docs/dev/debt/libkernel.md region. I fetched both exact heads and ran git merge-tree against their common base; the merge conflicts in that debt file (the shared CMake/API files merge cleanly). Please coordinate the agreed landing order with #9326 and record it in Depends on/the overlap note, or rebase and update the report after one lands. The hosted Windows test and policy checks are still running; this request is specifically for the confirmed documentation conflict.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 12060 docs/dev/debt/libkernel.md L319-320

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 4630 docs/dev/debt/libkernel.md
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 6149 docs/dev/debt/libkernel.md
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7135 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 7447 docs/dev/debt/libkernel.md
PR 7464 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
PR 7804 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 8605 docs/dev/debt/libkernel.md
PR 9156 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9242 core/libs/prx/libkernel/include/Api.hpp
docs/dev/debt/libkernel.md
PR 9284 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9293 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9297 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9302 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9383 core/libs/prx/libkernel/CMakeLists.txt
PR 9389 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9557 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9566 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9575 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 9929 core/libs/prx/libkernel/System/src/Process.cpp
PR 10319 docs/dev/debt/libkernel.md
PR 10442 docs/dev/debt/libkernel.md
PR 11002 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 11042 docs/dev/debt/libkernel.md
PR 11215 core/libs/prx/libkernel/Unimplemented.cpp
core/libs/prx/libkernel/include/Api.hpp
docs/dev/debt/libkernel.md
PR 11267 core/libs/prx/libkernel/include/Api.hpp
docs/dev/debt/libkernel.md
PR 11403 docs/dev/debt/libkernel.md
PR 11625 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 11872 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 11969 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 12068 core/libs/prx/libkernel/CMakeLists.txt
PR 12104 docs/dev/debt/libkernel.md

Returns 1 for the own pid and for -1, and 0 for pid 0, as a payload process on a PS5 (firmware 12.70) read (p86). Any other pid throws: another payload process got 0x80020003 for a stack pointer and an unspecified first argument (p85), and other existing pids were not tried. Adds a guest test and cuts the debt entry to what is still open.
@ionut27001
ionut27001 force-pushed the fix/libkernel-process-abi-type branch from 3e3726d to 4fddc50 Compare October 27, 2026 14:12
@ionut27001

Copy link
Copy Markdown
Contributor Author

Recorded the order with #9326: this lands after it (Depends on: #9326), and I will rebase the docs/dev/debt/libkernel.md entry once #9326 merges. Rebased onto main; the test passes twice on Windows.

@Gonic0

Gonic0 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

macOS run of head 4fddc50616: Apple M5 Pro, macOS 27.2, Apple clang 21, x86-64 Release under Rosetta 2. Tree: main 801d5b9bc1 plus the open macOS build PRs (#7631, #11249, #11358, #10669, #10552, #7804, #11447, #11437, #11554), with this PR's diff on top (the docs/ changes left out). Three runs per row.

guest_process_abi_type passes 3 of 3. I did not repeat your revert check: putting back only main's Process.cpp and Unimplemented.cpp does not compile against the new declaration in Api.hpp (conflicting types for 'sceKernelGetProcessAbiType'), as your description notes.

AI-assisted: yes

This branch has not been deployed

No deployments
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.

4 participants