Skip to content

feat(libSceGnmDriver): export the retail resource registration calls CUSA12982 imports - #28088

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
leskal:feat/libscegnmdriver-retail-imports
Dec 3, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
leskal:feat/libscegnmdriver-retail-imports

Conversation

@leskal

@leskal leskal commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What

CUSA12982 failed to link: it imports 31 functions from libSceGnmDriver that only libSceGnmDriverForNeoMode exported. Open PRs already add 14 of them to libSceGnmDriver: #27342 the two compute waits, sceGnmGetPhysicalCounterFromVirtualized and sceGnmLogicalTcaUnitToPhysical, and #27937 the ten validation calls. This PR adds the other 17, the resource and owner registration calls, as _nid_disambig1 copies like the functions the two modules already share:

  • sceGnmRegisterOwner and the 16 other registration calls return 0x8EEE00FF without reading their arguments, the value NeoMode returns for them and that shadPS4 returns as not available in retail firmware; recorded under Silent stubs

CUSA12982 needs this, #27342, #27937 and #28089.

Tested

Windows 10, WinLibs GCC 15.2.0 r7: guest_gnm_driver passes with the new registration checks. With these 17, the other 14 and the libSceVideoRecording imports in one build, CUSA12982 links, starts, loads its pak files and later stops on an unrelated app0.zar directory read.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: CUSA12982
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Compatibility
    • Added support for additional graphics resource and owner registration calls. These calls return the failure status observed in retail firmware rather than registering or querying resources.
  • Documentation
    • Documented the behavior and availability of these calls.

…CUSA12982 imports

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

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: GNM resource APIs

Layer / File(s) Summary
API declarations and stubs
core/libs/prx/libSceGnmDriver/include/Api.hpp, core/libs/prx/libSceGnmDriver/Export.cpp
The header declares 17 resource and owner registration APIs. The exports return Failure; only sceGnmRegisterOwner_nid_disambig1 has parameters.
Return-value checks and documentation
core/libs/tests/GuestGnmDriver.cpp, docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md
TestResourceRegistration checks that the APIs return 0x8EEE00FF and is called from main. The debt note describes the calls and their stated behavior.

Possibly related PRs

  • boykopovar/AnyPS5#27342: Adds other libSceGnmDriver exports that the pull request summary identifies as part of CUSA12982’s link requirement.
  • boykopovar/AnyPS5#27937: Adds other GNM changes that the pull request summary identifies as part of CUSA12982’s link requirement.

Suggested labels: prx

Suggested reviewers: donryuzaki, ntamas94, bunnyfl

Change: Feature

Merge Risk: Minimal · up to 208f9

This change adds 17 libSceGnmDriver registration exports that return a fixed failure code so a title can link and start. The stubs are simple and the new guest test checks their return values. No actionable merge-blocking risk was found.

Security architecture risk: Minimal · up to 208f9

The new exports let titles resolve these imports, but the calls themselves only return an error. They do not register resources, expose resource data, or grant callers new privileges.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Guest code that resolves the added retail symbols can reach 17 more handlers, but the inspected handlers expose only a constant status, not host or guest resource contents or operations.

Trust Boundaries and Controls

  • observed — The PR uses the existing export convention without modifying import resolver logic or build wiring. The test ranges invoke the new functions but do not add production entrypoints.

Resilience and Maintainability Implications

  • inferred — Because the handlers never begin a resource operation, repeated or concurrent calls cannot leave partial registrations or introduce cleanup obligations through these paths.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8afcad94-b56d-44e8-841a-22810c7848f1
Commits

Reviewing files that changed from the base of the PR and between 4f6d47e and 208f9c6.

Files selected for processing: 4

  • core/libs/prx/libSceGnmDriver/Export.cpp
  • core/libs/prx/libSceGnmDriver/include/Api.hpp
  • core/libs/tests/GuestGnmDriver.cpp
  • docs/dev/debt/changes/feat-libscegnmdriver-retail-imports.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@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.

Reviewed — looks good

Nothing blocks this change; the reviewed implementations match the stated silent-stub behavior and the evidence supports merging.

What I ran

Reviewed head 208f9c6fc651d38fc1c9d23cc3f9167f2b404f92. I read the prepared description, commits, manifest, and diff, plus all four changed files and the corresponding NeoMode stubs. I did not run commands or tests; repo_read.py was used to inspect the prepared bundle and pinned source.

Results

Check Result Note
Changed code review passed Four changed files read
Tests not run No test execution in this review

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author-reported Windows build, guest tests, and CUSA12982 run were not independently reproduced. Console behavior and the full repository test suite were not verified. No files were excluded from the review bundle.

To get this to a good state

Nothing is required.

@JJenkx

JJenkx commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Linux check of the exact head 208f9c6fc651; the description has no Linux results. Arch Linux 7.3.5 x86-64, GCC 16.2.1, Release, -DBUILD_TESTING=ON:

  • ctest -R guest_gnm_driver (this PR's GuestGnmDriver.cpp cases): 3 pass, 0 skipped.

AI-assisted: yes

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Exports with a name or library/NID already present in main:

  • sceGnmFindResourcesPublic (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetOwnerName (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceBaseAddressAndSizeInBytes (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceName (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceShaderGuid (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceType (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmGetResourceUserData (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmQueryResourceRegistrationUserMemoryRequirements (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterGdsResource (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterOwner (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterOwnerForSystem (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmRegisterResource (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmSetResourceRegistrationUserMemory (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmSetResourceUserData (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmUnregisterAllResourcesForOwner (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmUnregisterOwnerAndResources (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)
  • sceGnmUnregisterResource (also exported by another library in main: core/libs/prx/libSceGnmDriverForNeoMode; may be intentional)

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 23696 core/libs/prx/libSceGnmDriver/Export.cpp
core/libs/prx/libSceGnmDriver/include/Api.hpp

@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line docs prx review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 28, 2026
@github-actions

Copy link
Copy Markdown

Progress report (4f6d47e → 208f9c6)

📈 System libraries: 47.85% (+0.03%, +17 implemented functions)

✅ 17 implemented
Library Name
libSceGnmDriver sceGnmFindResourcesPublic_nid_disambig1
libSceGnmDriver sceGnmGetOwnerName_nid_disambig1
libSceGnmDriver sceGnmGetResourceBaseAddressAndSizeInBytes_nid_disambig1
libSceGnmDriver sceGnmGetResourceName_nid_disambig1
libSceGnmDriver sceGnmGetResourceShaderGuid_nid_disambig1
libSceGnmDriver sceGnmGetResourceType_nid_disambig1
libSceGnmDriver sceGnmGetResourceUserData_nid_disambig1
libSceGnmDriver sceGnmQueryResourceRegistrationUserMemoryRequirements_nid_disambig1
libSceGnmDriver sceGnmRegisterGdsResource_nid_disambig1
libSceGnmDriver sceGnmRegisterOwnerForSystem_nid_disambig1
libSceGnmDriver sceGnmRegisterOwner_nid_disambig1
libSceGnmDriver sceGnmRegisterResource_nid_disambig1
libSceGnmDriver sceGnmSetResourceRegistrationUserMemory_nid_disambig1
libSceGnmDriver sceGnmSetResourceUserData_nid_disambig1
libSceGnmDriver sceGnmUnregisterAllResourcesForOwner_nid_disambig1
libSceGnmDriver sceGnmUnregisterOwnerAndResources_nid_disambig1
libSceGnmDriver sceGnmUnregisterResource_nid_disambig1
⚪ 17 behaviourally empty (constant return or throw)
Library Name
libSceGnmDriver sceGnmFindResourcesPublic_nid_disambig1
libSceGnmDriver sceGnmGetOwnerName_nid_disambig1
libSceGnmDriver sceGnmGetResourceBaseAddressAndSizeInBytes_nid_disambig1
libSceGnmDriver sceGnmGetResourceName_nid_disambig1
libSceGnmDriver sceGnmGetResourceShaderGuid_nid_disambig1
libSceGnmDriver sceGnmGetResourceType_nid_disambig1
libSceGnmDriver sceGnmGetResourceUserData_nid_disambig1
libSceGnmDriver sceGnmQueryResourceRegistrationUserMemoryRequirements_nid_disambig1
libSceGnmDriver sceGnmRegisterGdsResource_nid_disambig1
libSceGnmDriver sceGnmRegisterOwnerForSystem_nid_disambig1
libSceGnmDriver sceGnmRegisterOwner_nid_disambig1
libSceGnmDriver sceGnmRegisterResource_nid_disambig1
libSceGnmDriver sceGnmSetResourceRegistrationUserMemory_nid_disambig1
libSceGnmDriver sceGnmSetResourceUserData_nid_disambig1
libSceGnmDriver sceGnmUnregisterAllResourcesForOwner_nid_disambig1
libSceGnmDriver sceGnmUnregisterOwnerAndResources_nid_disambig1
libSceGnmDriver sceGnmUnregisterResource_nid_disambig1

Changed libraries (implemented exports)

Library Before After Change
libSceGnmDriver 63/94 (67.02%) 80/111 (72.07%) +5.05%

@ycbuzi

ycbuzi commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Tested 208f9c6fc6 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 2 tests failed out of 7444; 99% tests passed, 4 tests failed out of 7444. 2 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 7444; 100% tests passed, 0 tests failed out of 7444. run

Not covered: GPU. This pull request changes GPU code, and the GitHub-hosted runners above have no GPU, so the Vulkan and GPU tests fail there on main and on this pull request alike. This result says nothing about the changed GPU paths; they still need a run on a real GPU.

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Dec 1, 2026
@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Dec 3, 2026

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I built both production registration implementations on Linux. All 17 retail wrappers returned 0x8EEE00FF, matching the corresponding NeoMode calls. sceGnmRegisterOwner also preserved the supplied output sentinel.

I then ran the actual ELF NID patcher on the 17 retail exports and compared the resulting symbol table with the NIDs computed from the unsuffixed names. All 17 matched with no duplicates. This verifies the replacement exports and host return values. Retail hardware and the complete CUSA12982 import load were outside this run.

AI-assisted: yes.

@Plyxen Plyxen 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.

I read the diff at 208f9c6fc6. Windows 11, GCC 15.2, merged into main at cf556db18c3 together with other open PRs (so not an isolated build).

  • guest_gnm_driver: pass.
  • Control (same tree and tests, the changed files of those PRs put back to main's): the test doesn't link without the new exports.

Not checked: CUSA titles, and Linux.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit a1b75b0 into boykopovar:main Dec 3, 2026
15 of 19 checks passed
@leskal
leskal deleted the feat/libscegnmdriver-retail-imports branch December 3, 2026 22:06
@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants