feat(libkernel_sys): implement environment identity predicates #15970

Closed
ashwin280802 wants to merge 1 commit from upstream-pr/15970 into main
ashwin280802 commented 2026-11-05 04:19:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ashwin280802 on 2026-11-05T04:19:54Z.


What

Implement six libkernel_sys environment and hardware identity predicates to model AnyPS5's baseline retail CEX Prospero environment:

  • sceKernelIsAuthenticTrinity (returns 0: base PS5 Prospero, non-Trinity)
  • sceKernelIsCloudDevkit (returns 0: retail CEX)
  • sceKernelIsCloudkit (returns 0: retail CEX)
  • sceKernelIsCronos (returns 0: retail CEX, not Cronos cloud server)
  • sceKernelIsDebuggerAttached (returns 0: no debugger attached)
  • sceKernelIsM2DeviceAttached (returns 0: internal base storage, no secondary M.2 SSD)

Documents the silent stubs under ### Silent stubs in docs/dev/debt/libkernel_sys.md, prunes the 4 implemented entries from the throwing stubs inventory table, and synchronizes the table count to 312. Adds test assertions for all 6 predicates in guest_kernel_sys_constants.

Tested

Windows 11 (AMD64, Intel Core i5-14600K):

  • Unit test guest_kernel_sys_constants:
ctest --test-dir build-full -R guest_kernel_sys_constants -V
test 605: guest_kernel_sys_constants ....... Passed 0.07 sec
100% tests passed out of 1
  • Related identity & constant return tests guest_kernel_sys_(console_identity|constant_unknowns|constants|cpumode|neo_mode):
100% tests passed out of 5
  • Mutation test: Deliberately inverted sceKernelIsDebuggerAttached() to return 1; test failed immediately with SIGABRT / 0xc0000409.
  • Conventions check: python3 tools/check_conventions.py --base origin/main passed cleanly with 0 errors.

Not verified: Physical console return values under dynamic hardware reconfiguration or attached debuggers.

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:5166070089 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15970). Originally posted by [ashwin280802](https://github.com/ashwin280802) on 2026-11-05T04:19:54Z. --- ### What Implement six `libkernel_sys` environment and hardware identity predicates to model AnyPS5's baseline retail CEX Prospero environment: - `sceKernelIsAuthenticTrinity` (returns 0: base PS5 Prospero, non-Trinity) - `sceKernelIsCloudDevkit` (returns 0: retail CEX) - `sceKernelIsCloudkit` (returns 0: retail CEX) - `sceKernelIsCronos` (returns 0: retail CEX, not Cronos cloud server) - `sceKernelIsDebuggerAttached` (returns 0: no debugger attached) - `sceKernelIsM2DeviceAttached` (returns 0: internal base storage, no secondary M.2 SSD) Documents the silent stubs under `### Silent stubs` in `docs/dev/debt/libkernel_sys.md`, prunes the 4 implemented entries from the throwing stubs inventory table, and synchronizes the table count to 312. Adds test assertions for all 6 predicates in `guest_kernel_sys_constants`. ### Tested Windows 11 (AMD64, Intel Core i5-14600K): - Unit test `guest_kernel_sys_constants`: ``` ctest --test-dir build-full -R guest_kernel_sys_constants -V test 605: guest_kernel_sys_constants ....... Passed 0.07 sec 100% tests passed out of 1 ``` - Related identity & constant return tests `guest_kernel_sys_(console_identity|constant_unknowns|constants|cpumode|neo_mode)`: ``` 100% tests passed out of 5 ``` - Mutation test: Deliberately inverted `sceKernelIsDebuggerAttached()` to return 1; test failed immediately with SIGABRT / 0xc0000409. - Conventions check: `python3 tools/check_conventions.py --base origin/main` passed cleanly with 0 errors. Not verified: Physical console return values under dynamic hardware reconfiguration or attached debuggers. ### 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

Pull request closed

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!15970
No description provided.