feat(libkernel): implement sceKernelGetSystemSwVersion #2945

Merged
MarcZX10 merged 5 commits from upstream-pr/2945 into main 2026-10-11 07:49:38 +00:00
MarcZX10 commented 2026-10-10 18:45:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T18:45:17Z.


What

Implement sceKernelGetSystemSwVersion for the startup path reported by ProsperoStore (PPSA99000). It checks a null output pointer and the expected 40-byte size, returns SCE_KERNEL_ERROR_EFAULT or SCE_KERNEL_ERROR_EINVAL without changing guest errno, and writes the baseline version 01.000.000 / 0x01000000.

The 40-byte structure uses a 64-bit size at offset 0, versionString at offset 8, and version at 0x24. This matches the caller in ProsperoStore and the declarations in shadPS4, fpPS4 and OpenOrbis. The guest test pins these offsets with static_asserts. These references support the ABI layout, but do not verify the reported console firmware value 0x01000000, which remains documented as unverified in TechnicalDebt.md.

This carries the implementation and error-handling correction from Pushkar Reddy while preserving his commit authorship.

Depends on: none. #2902 and #3218 touch the same guest test file, so the branch that merges second may need a small rebase to resolve the shared test call site.

Tested

On current main (961b25fe) after rebasing, Linux GCC 12.2 Release:

  • cmake --build /tmp/AnyPS5-build-2945-rebased-release --target guest_system_configuration_tests -j2
  • ctest --test-dir /tmp/AnyPS5-build-2945-rebased-release -R "^guest_system_configuration$" --output-on-failure (1/1 passed)
  • python3 tools/check_conventions.py --base upstream/main and git diff upstream/main...HEAD --check (passed)

The console firmware value remains unverified.

Checklist

  • Based on current main; no other open PR implements the same function
  • 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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not title-specific
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4813590380 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T18:45:17Z. --- ### What Implement `sceKernelGetSystemSwVersion` for the startup path reported by ProsperoStore (PPSA99000). It checks a null output pointer and the expected 40-byte size, returns `SCE_KERNEL_ERROR_EFAULT` or `SCE_KERNEL_ERROR_EINVAL` without changing guest `errno`, and writes the baseline version `01.000.000` / `0x01000000`. The 40-byte structure uses a 64-bit `size` at offset 0, `versionString` at offset 8, and `version` at `0x24`. This matches the caller in [ProsperoStore](https://github.com/blackbearreloaded/ProsperoStore/blob/20584011/src/diag/trace.cpp#L20-L26) and the declarations in [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/811bfcd7d1/src/core/libraries/kernel/kernel.h#L45-L49), [fpPS4](https://github.com/red-prig/fpPS4/blob/04cefd43e6/kernel/ps4_libkernel.pas#L502-L506) and [OpenOrbis](https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/0a1aaf9dd4/include/orbis/_types/kernel.h#L256-L260). The guest test pins these offsets with `static_assert`s. These references support the ABI layout, but do not verify the reported console firmware value `0x01000000`, which remains documented as unverified in `TechnicalDebt.md`. This carries the implementation and error-handling correction from Pushkar Reddy while preserving his commit authorship. Depends on: none. #2902 and #3218 touch the same guest test file, so the branch that merges second may need a small rebase to resolve the shared test call site. ### Tested On current `main` (`961b25fe`) after rebasing, Linux GCC 12.2 Release: - `cmake --build /tmp/AnyPS5-build-2945-rebased-release --target guest_system_configuration_tests -j2` - `ctest --test-dir /tmp/AnyPS5-build-2945-rebased-release -R "^guest_system_configuration$" --output-on-failure` (1/1 passed) - `python3 tools/check_conventions.py --base upstream/main` and `git diff upstream/main...HEAD --check` (passed) The console firmware value remains unverified. ### Checklist - [x] Based on current `main`; no other open PR implements the same function - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not title-specific - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-10 19:07:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T19:07:46Z.


Progress report (2a4e03c → 1583126)

➖ System libraries: 85.83% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceKernelGetSystemSwVersion_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101144539 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6101144539). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T19:07:46Z. --- <!-- progress-report --> ### Progress report (2a4e03c → 1583126) ➖ **System libraries**: 85.83% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `sceKernelGetSystemSwVersion_nid_postfix` | </details>
oneandonlydean commented 2026-10-10 19:18:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T19:18:13Z.


The error paths at SystemConfiguration.cpp:117-124 return -1 and set errno; please return SCE_KERNEL_ERROR_EFAULT and SCE_KERNEL_ERROR_EINVAL instead, as the other sceKernel* functions do (e.g. Aio.cpp), and update the test to match.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101237573 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6101237573). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T19:18:13Z. --- The error paths at `SystemConfiguration.cpp:117-124` return -1 and set errno; please return `SCE_KERNEL_ERROR_EFAULT` and `SCE_KERNEL_ERROR_EINVAL` instead, as the other `sceKernel*` functions do (e.g. `Aio.cpp`), and update the test to match.
pushkarreddyy commented 2026-10-10 19:49:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-10T19:49:18Z.


Updated error handling per review feedback: sceKernelGetSystemSwVersion_nid_postfix now returns SCE_KERNEL_ERROR_EFAULT on null pointer and SCE_KERNEL_ERROR_EINVAL on size mismatch without altering errno, and unit test assertions in GuestSystemConfiguration.cpp have been updated to match.

The updated commit is ready on my fork branch:
github.com/pushkarreddyy/AnyPS5@f3dc623465

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101522319 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6101522319). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-10T19:49:18Z. --- Updated error handling per review feedback: `sceKernelGetSystemSwVersion_nid_postfix` now returns `SCE_KERNEL_ERROR_EFAULT` on null pointer and `SCE_KERNEL_ERROR_EINVAL` on size mismatch without altering errno, and unit test assertions in `GuestSystemConfiguration.cpp` have been updated to match. The updated commit is ready on my fork branch: https://github.com/pushkarreddyy/AnyPS5/commit/f3dc623465c621d4027e7aee47ac3a35082f681c
pushkarreddyy commented 2026-10-10 20:06:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-10T20:06:01Z.


@oneandonlydean I have updated the error paths per your review: sceKernelGetSystemSwVersion_nid_postfix now returns SCE_KERNEL_ERROR_EFAULT on null pointer and SCE_KERNEL_ERROR_EINVAL on size mismatch directly without setting errno, and the guest unit tests in GuestSystemConfiguration.cpp have been updated to assert these error codes and verify errno remains untouched.

The updated commit is ready on my branch and PR:

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101663984 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6101663984). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-10T20:06:01Z. --- @oneandonlydean I have updated the error paths per your review: sceKernelGetSystemSwVersion_nid_postfix now returns SCE_KERNEL_ERROR_EFAULT on null pointer and SCE_KERNEL_ERROR_EINVAL on size mismatch directly without setting errno, and the guest unit tests in GuestSystemConfiguration.cpp have been updated to assert these error codes and verify errno remains untouched. The updated commit is ready on my branch and PR: - Branch: https://github.com/pushkarreddyy/AnyPS5/tree/feat/libkernel-system-sw-version - Commit: https://github.com/pushkarreddyy/AnyPS5/commit/9712ae6e95593b34aabdeaaab8fabaf4b70b1531 - PR into carry branch: https://github.com/MarcZX100/AnyPS5/pull/1 (conventions CI 100% green)
MarcZX10 commented 2026-10-10 20:21:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T20:21:44Z.


Thanks @oneandonlydean for identifying the error convention, and thanks @pushkarreddyy for preparing the correction and updated assertions. I reviewed and carried Pushkar's commit onto current main, preserving its author attribution.

The null and size-mismatch cases now return SCE_KERNEL_ERROR_EFAULT and SCE_KERNEL_ERROR_EINVAL directly, and the tests verify that guest errno is unchanged. The Release build of guest_system_configuration_tests succeeds, and guest_system_configuration passes 1/1. Conventions and git diff --check pass as well.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101798807 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6101798807). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T20:21:44Z. --- Thanks @oneandonlydean for identifying the error convention, and thanks @pushkarreddyy for preparing the correction and updated assertions. I reviewed and carried Pushkar's commit onto current `main`, preserving its author attribution. The null and size-mismatch cases now return `SCE_KERNEL_ERROR_EFAULT` and `SCE_KERNEL_ERROR_EINVAL` directly, and the tests verify that guest `errno` is unchanged. The Release build of `guest_system_configuration_tests` succeeds, and `guest_system_configuration` passes 1/1. Conventions and `git diff --check` pass as well.
screamm commented 2026-10-10 20:47:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T20:47:13Z.


Windows validation of the current head 7eb6db10 merged onto main 56fb1b3b (without #2902, which conflicts in the same file; this PR alone merges cleanly).

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including the libs target.

  • guest_system_configuration passes 3/3 (--repeat until-fail:3).
  • ctest -j8 -E "^agc_|video_out" passes 388/388.
  • With main's SystemConfiguration.cpp and this PR's test, the test fails, so the coverage detects the missing export.

Validation run with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102014671 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6102014671). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T20:47:13Z. --- Windows validation of the current head `7eb6db10` merged onto `main` `56fb1b3b` (without #2902, which conflicts in the same file; this PR alone merges cleanly). Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including the `libs` target. - `guest_system_configuration` passes 3/3 (`--repeat until-fail:3`). - `ctest -j8 -E "^agc_|video_out"` passes 388/388. - With `main`'s `SystemConfiguration.cpp` and this PR's test, the test fails, so the coverage detects the missing export. Validation run with Claude Code assistance.
pushkarreddyy commented 2026-10-10 21:03:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-10T21:03:48Z.


Thank you @screamm for taking the time to validate this on Windows 11, really appreciate the thorough testing!

Special thanks to @oneandonlydean and @MarcZX100 for reviewing, guiding me on conventions, and carrying these patches forward — really grateful for the support and looking forward to contributing more to AnyPS5.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102154309 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6102154309). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-10T21:03:48Z. --- Thank you @screamm for taking the time to validate this on Windows 11, really appreciate the thorough testing! Special thanks to @oneandonlydean and @MarcZX100 for reviewing, guiding me on conventions, and carrying these patches forward — really grateful for the support and looking forward to contributing more to AnyPS5.
MarcZX10 commented 2026-10-10 21:06:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T21:06:01Z.


Thanks, Pushkar. I compared 9712ae6 with the correction already carried in this PR (ed41cc3): they have the same patch, including the guest errno preservation assertions. Your correction is already present here with your original commit author attribution preserved, so no duplicate commit or extra PR update is needed. The current PR checks are green, and the Windows validation posted above covers the corrected head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102173278 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6102173278). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T21:06:01Z. --- Thanks, Pushkar. I compared `9712ae6` with the correction already carried in this PR (`ed41cc3`): they have the same patch, including the guest `errno` preservation assertions. Your correction is already present here with your original commit author attribution preserved, so no duplicate commit or extra PR update is needed. The current PR checks are green, and the Windows validation posted above covers the corrected head.
screamm commented 2026-10-10 21:12:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T21:12:24Z.


Rerun on the corrected head ed41cc35 merged onto main 262c0316, same Windows 11 / WinLibs GCC 15.2.0 r7 / Release setup: guest_system_configuration passes 3/3 and ctest -j8 -E "^agc_|video_out" passes 388/388.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102226794 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6102226794). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T21:12:24Z. --- Rerun on the corrected head `ed41cc35` merged onto `main` `262c0316`, same Windows 11 / WinLibs GCC 15.2.0 r7 / Release setup: `guest_system_configuration` passes 3/3 and `ctest -j8 -E "^agc_|video_out"` passes 388/388.
fma-rc commented 2026-10-10 22:38:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-10T22:38:13Z.


A question on the struct layout, since the test uses the same struct as the implementation and can't catch a difference. The PR has uint32_t size; char versionString[0x1C]; uint32_t version; uint32_t unk_24;, so the string starts at offset 4 and version is at 0x20. shadPS4's definition for the PS4 call (src/core/libraries/kernel/kernel.h, SwVersionStruct) is u64 struct_size; char text_representation[0x1c]; u32 hex_representation;, which puts the string at 8 and the number at 0x24. Both are 40 bytes, so the size check passes either way.

I have no title here that calls it, so I can't say which one the PS5 uses. If the layout in the PR comes from a disassembly of a caller, a line saying so in the TechnicalDebt entry would settle it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102933955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6102933955). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-10T22:38:13Z. --- A question on the struct layout, since the test uses the same struct as the implementation and can't catch a difference. The PR has `uint32_t size; char versionString[0x1C]; uint32_t version; uint32_t unk_24;`, so the string starts at offset 4 and `version` is at 0x20. shadPS4's definition for the PS4 call (`src/core/libraries/kernel/kernel.h`, `SwVersionStruct`) is `u64 struct_size; char text_representation[0x1c]; u32 hex_representation;`, which puts the string at 8 and the number at 0x24. Both are 40 bytes, so the size check passes either way. I have no title here that calls it, so I can't say which one the PS5 uses. If the layout in the PR comes from a disassembly of a caller, a line saying so in the TechnicalDebt entry would settle it.
MarcZX10 commented 2026-10-10 23:01:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T23:01:58Z.


Thanks for pointing out that the test and implementation share the same declaration. The layout was not taken from a caller disassembly: issue #2906 proposes the 40-byte structure but provides no source for the field offsets. I added that explicitly to the TechnicalDebt.md entry, including the assumed offsets and the test's ABI limitation, and updated the PR description to match.

The implementation and test commits are unchanged and retain Pushkar Reddy's authorship. I rebased onto current main (64baa79b); conventions and git diff --check pass. The focused Release CTest passed on the prior corrected head. I could not repeat the build after rebasing because this worktree lacks third-party submodule checkouts, and no console ABI measurement is available.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103116202 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6103116202). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T23:01:58Z. --- Thanks for pointing out that the test and implementation share the same declaration. The layout was not taken from a caller disassembly: issue #2906 proposes the 40-byte structure but provides no source for the field offsets. I added that explicitly to the `TechnicalDebt.md` entry, including the assumed offsets and the test's ABI limitation, and updated the PR description to match. The implementation and test commits are unchanged and retain Pushkar Reddy's authorship. I rebased onto current `main` (`64baa79b`); conventions and `git diff --check` pass. The focused Release CTest passed on the prior corrected head. I could not repeat the build after rebasing because this worktree lacks third-party submodule checkouts, and no console ABI measurement is available.
orishamir commented 2026-10-10 23:26:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-10T23:26:16Z.


The caller the blocker names is open source and answers @fma-rc's layout question. ProsperoStore src/diag/trace.cpp, call at lines 180-183:

struct SwVersion {
    std::uint64_t size;
    char text[0x1c];
    std::uint32_t version;
};
...
SwVersion version{sizeof(SwVersion), {}, 0};
const int read = sceKernelGetSystemSwVersion(&version);
trace("firmware: %s (0x%08x)", read == 0 ? version.text : "unknown", static_cast<unsigned>(version.version));

size is 8 bytes, the string starts at 8 and version is at 0x24. shadPS4 (SwVersionStruct), fpPS4 (t_sw_version) and the OpenOrbis header (OrbisKernelSwVersion) declare the same 40 bytes: a 64-bit size, char[0x1c], uint32_t. None has this PR's 32-bit size, string at 4, version at 0x20 and unk_24.

Effect on the title, measured by calling this PR's function body verbatim (struct and code from SystemConfiguration.cpp @ b3f476ec) through the title's struct in a host g++ probe: the size check passes (the low dword of the 64-bit size is 40), the call returns 0, and the title's trace line comes out as firmware: 00.000 (0x00000000), since it reads the string from offset 8 and version from 0x24, where this PR writes unk_24 = 0. The import resolves, so the startup stop in #2908 is gone either way; the wrong values appear only in the store's "Debug log" trace (trace_console runs when that setting is on; the GNUmakefile says the trace is in every build). std::uint64_t size and no unk_24 is the layout all four sources use, and the TechnicalDebt entry could cite them instead of calling the layout unverified.

probe
namespace pr2945 { /* SceKernelSystemSwVersion and sceKernelGetSystemSwVersion_nid_postfix copied from this PR */ }
struct SwVersion { std::uint64_t size; char text[0x1c]; std::uint32_t version; };   // ProsperoStore trace.cpp:20
static_assert(offsetof(SwVersion, text) == 8 && offsetof(SwVersion, version) == 0x24 && sizeof(SwVersion) == 40);
SwVersion version{sizeof(SwVersion), {}, 0};
int read = pr2945::sceKernelGetSystemSwVersion(reinterpret_cast<pr2945::SceKernelSystemSwVersion*>(&version));
std::printf("return %d\nfirmware: %s (0x%08x)\n", read, read == 0 ? version.text : "unknown", version.version);
// return 0
// firmware: 00.000 (0x00000000)

Linux run of b3f476ec, since the description says the rebased head could not be built: replica of the CI linux job (ubuntu 24.04, GCC 13.3, llvmpipe), build clean, guest_system_configuration 5/5, full suite 737/738 (the one failure is #2386's new agc_driver_image_packed16_load on lavapipe, red in CI's linux job on main since 22:41Z and unrelated to this PR). Revert-pin, main's SystemConfiguration.cpp with this PR's test: the test binary does not link (undefined reference to sceKernelGetSystemSwVersion_nid_postfix), so the test pins the export.

Merge order: with #2902 merged first, this head still conflicts in core/libs/tests/GuestSystemConfiguration.cpp (both add a check function and its call in main() at the same place); the other order conflicts the same way, so whichever lands second needs a one-hunk rebase.

Thanks @MarcZX100 for carrying this and @fma-rc for asking.

AI-assisted: yes (Claude Code Fable 5.1 xhigh)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103301365 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6103301365). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-10T23:26:16Z. --- The caller the blocker names is open source and answers @fma-rc's layout question. ProsperoStore [`src/diag/trace.cpp`](https://github.com/blackbearreloaded/ProsperoStore/blob/20584011/src/diag/trace.cpp#L20-L26), call at [lines 180-183](https://github.com/blackbearreloaded/ProsperoStore/blob/20584011/src/diag/trace.cpp#L180-L183): ```cpp struct SwVersion { std::uint64_t size; char text[0x1c]; std::uint32_t version; }; ... SwVersion version{sizeof(SwVersion), {}, 0}; const int read = sceKernelGetSystemSwVersion(&version); trace("firmware: %s (0x%08x)", read == 0 ? version.text : "unknown", static_cast<unsigned>(version.version)); ``` `size` is 8 bytes, the string starts at 8 and `version` is at 0x24. shadPS4 ([`SwVersionStruct`](https://github.com/shadps4-emu/shadPS4/blob/811bfcd7d1/src/core/libraries/kernel/kernel.h#L45-L49)), fpPS4 ([`t_sw_version`](https://github.com/red-prig/fpPS4/blob/04cefd43e6/kernel/ps4_libkernel.pas#L502-L506)) and the OpenOrbis header ([`OrbisKernelSwVersion`](https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/0a1aaf9dd4/include/orbis/_types/kernel.h#L256-L260)) declare the same 40 bytes: a 64-bit size, `char[0x1c]`, `uint32_t`. None has this PR's 32-bit `size`, string at 4, `version` at 0x20 and `unk_24`. Effect on the title, measured by calling this PR's function body verbatim (struct and code from `SystemConfiguration.cpp` @ b3f476ec) through the title's struct in a host g++ probe: the size check passes (the low dword of the 64-bit size is 40), the call returns 0, and the title's trace line comes out as `firmware: 00.000 (0x00000000)`, since it reads the string from offset 8 and `version` from 0x24, where this PR writes `unk_24 = 0`. The import resolves, so the startup stop in #2908 is gone either way; the wrong values appear only in the store's "Debug log" trace (`trace_console` runs when that setting is on; the GNUmakefile says the trace is in every build). `std::uint64_t size` and no `unk_24` is the layout all four sources use, and the TechnicalDebt entry could cite them instead of calling the layout unverified. <details><summary>probe</summary> ```cpp namespace pr2945 { /* SceKernelSystemSwVersion and sceKernelGetSystemSwVersion_nid_postfix copied from this PR */ } struct SwVersion { std::uint64_t size; char text[0x1c]; std::uint32_t version; }; // ProsperoStore trace.cpp:20 static_assert(offsetof(SwVersion, text) == 8 && offsetof(SwVersion, version) == 0x24 && sizeof(SwVersion) == 40); SwVersion version{sizeof(SwVersion), {}, 0}; int read = pr2945::sceKernelGetSystemSwVersion(reinterpret_cast<pr2945::SceKernelSystemSwVersion*>(&version)); std::printf("return %d\nfirmware: %s (0x%08x)\n", read, read == 0 ? version.text : "unknown", version.version); // return 0 // firmware: 00.000 (0x00000000) ``` </details> Linux run of b3f476ec, since the description says the rebased head could not be built: replica of the CI `linux` job (ubuntu 24.04, GCC 13.3, llvmpipe), build clean, `guest_system_configuration` 5/5, full suite 737/738 (the one failure is #2386's new `agc_driver_image_packed16_load` on lavapipe, red in CI's `linux` job on `main` since 22:41Z and unrelated to this PR). Revert-pin, main's `SystemConfiguration.cpp` with this PR's test: the test binary does not link (`undefined reference to sceKernelGetSystemSwVersion_nid_postfix`), so the test pins the export. Merge order: with #2902 merged first, this head still conflicts in `core/libs/tests/GuestSystemConfiguration.cpp` (both add a check function and its call in `main()` at the same place); the other order conflicts the same way, so whichever lands second needs a one-hunk rebase. Thanks @MarcZX100 for carrying this and @fma-rc for asking. AI-assisted: yes (Claude Code Fable 5.1 xhigh)
adriadam10 commented 2026-10-11 00:11:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:11:55Z.

Review: CHANGES_REQUESTED


Thanks for carrying this. One blocking problem, the struct layout (raised by @fma-rc, confirmed by @orishamir's probe):

  • core/libs/prx/libkernel/System/src/SystemConfiguration.cpp:19-24 declares uint32_t size; char versionString[0x1C]; uint32_t version; uint32_t unk_24;. Every available source declares a 64-bit size: u64 struct_size; char text_representation[0x1c]; u32 hex_representation; (shadPS4 kernel.h SwVersionStruct, fpPS4 t_sw_version, OpenOrbis OrbisKernelSwVersion), and the ProsperoStore caller itself (src/diag/trace.cpp:20) uses uint64_t size; char text[0x1c]; uint32_t version;. That puts the string at offset 8 and version at 0x24, not 4 and 0x20, and there is no unk_24.
  • With this PR's layout the size check passes by accident (low dword of the 64-bit size is 40) but the title reads firmware: 00.000 (0x00000000).
  • core/libs/tests/GuestSystemConfiguration.cpp:8-13 repeats the implementation's struct, so it cannot catch this. Please declare the struct as the title does and check the string at offset 8 and version at 0x24 (e.g. offsetof/static_assert).
  • docs/dev/TechnicalDebt.md:47: cite those four sources for the layout; what stays unverified is only the value 01.000.000 / 0x01000000 on a console.

Also, #2902 and this PR conflict in GuestSystemConfiguration.cpp (both add a check function and its call in main() at the same spot); whichever lands second needs a one-hunk rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481288340 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#pullrequestreview-5481288340). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:11:55Z. **Review:** CHANGES_REQUESTED --- Thanks for carrying this. One blocking problem, the struct layout (raised by @fma-rc, confirmed by @orishamir's probe): - `core/libs/prx/libkernel/System/src/SystemConfiguration.cpp:19-24` declares `uint32_t size; char versionString[0x1C]; uint32_t version; uint32_t unk_24;`. Every available source declares a 64-bit size: `u64 struct_size; char text_representation[0x1c]; u32 hex_representation;` (shadPS4 `kernel.h` `SwVersionStruct`, fpPS4 `t_sw_version`, OpenOrbis `OrbisKernelSwVersion`), and the ProsperoStore caller itself (`src/diag/trace.cpp:20`) uses `uint64_t size; char text[0x1c]; uint32_t version;`. That puts the string at offset 8 and `version` at 0x24, not 4 and 0x20, and there is no `unk_24`. - With this PR's layout the size check passes by accident (low dword of the 64-bit size is 40) but the title reads `firmware: 00.000 (0x00000000)`. - `core/libs/tests/GuestSystemConfiguration.cpp:8-13` repeats the implementation's struct, so it cannot catch this. Please declare the struct as the title does and check the string at offset 8 and `version` at 0x24 (e.g. `offsetof`/`static_assert`). - `docs/dev/TechnicalDebt.md:47`: cite those four sources for the layout; what stays unverified is only the value `01.000.000` / `0x01000000` on a console. Also, #2902 and this PR conflict in `GuestSystemConfiguration.cpp` (both add a check function and its call in `main()` at the same spot); whichever lands second needs a one-hunk rebase.
MarcZX10 commented 2026-10-11 01:16:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T01:16:35Z.


Thanks for tracing the caller and comparing the available declarations. I corrected the structure to match the observed 40-byte layout:

Field Offset
uint64_t size 0x00
char versionString[0x1c] 0x08
uint32_t version 0x24

The unused unk_24 field is removed. The guest test now asserts those offsets and the total size independently of runtime values. TechnicalDebt.md cites the ProsperoStore caller, shadPS4, fpPS4, and OpenOrbis as layout evidence; only the reported firmware value remains unverified.

I rebased onto current main and pushed the correction in 2169405f9 (fix(libkernel): correct system version ABI layout), preserving Pushkar Reddy's implementation and error-handling commit authorship. GCC C++20 syntax checks for the implementation and test, conventions, and git diff --check pass. I could not run the runtime CTest on this head because this worktree lacks the third-party submodules required for a full build.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104111378 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6104111378). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T01:16:35Z. --- Thanks for tracing the caller and comparing the available declarations. I corrected the structure to match the observed 40-byte layout: | Field | Offset | | --- | ---: | | `uint64_t size` | `0x00` | | `char versionString[0x1c]` | `0x08` | | `uint32_t version` | `0x24` | The unused `unk_24` field is removed. The guest test now asserts those offsets and the total size independently of runtime values. `TechnicalDebt.md` cites the ProsperoStore caller, shadPS4, fpPS4, and OpenOrbis as layout evidence; only the reported firmware value remains unverified. I rebased onto current `main` and pushed the correction in `2169405f9` (`fix(libkernel): correct system version ABI layout`), preserving Pushkar Reddy's implementation and error-handling commit authorship. GCC C++20 syntax checks for the implementation and test, conventions, and `git diff --check` pass. I could not run the runtime CTest on this head because this worktree lacks the third-party submodules required for a full build.
MarcZX10 commented 2026-10-11 03:16:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T03:16:00Z.


The overlap notice points to #3218, which adds the independent kern.rng_pseudo export. It shares SystemConfiguration.cpp and the guest system-configuration test translation unit, but this PR does not depend on it and the exports are distinct. No dependency is needed; if either merges first, the remaining branch will need the corresponding rebase/conflict resolution.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104939153 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6104939153). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T03:16:00Z. --- The overlap notice points to #3218, which adds the independent `kern.rng_pseudo` export. It shares `SystemConfiguration.cpp` and the guest system-configuration test translation unit, but this PR does not depend on it and the exports are distinct. No dependency is needed; if either merges first, the remaining branch will need the corresponding rebase/conflict resolution.
MarcZX10 commented 2026-10-11 03:41:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T03:41:19Z.


Thanks for the blocking ABI review and for the caller probe. The current head 7d39777d corrects the structure to uint64_t size, versionString at 0x08, and version at 0x24, removes unk_24, and pins the offsets and 40-byte size with independent test static_asserts. The TechnicalDebt entry now cites the ProsperoStore caller plus shadPS4, fpPS4, and OpenOrbis; only the console firmware value remains unverified.

I rebased the four authored commits onto current main (961b25fe), rebuilt the Release test target, and guest_system_configuration passes (1/1); conventions and diff checks pass. The description now lists no dependency: #2902 and #3218 are independent changes that share the test call site, so whichever merges second may need a small rebase. Please re-review the corrected head when convenient.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105111258 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6105111258). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T03:41:19Z. --- Thanks for the blocking ABI review and for the caller probe. The current head `7d39777d` corrects the structure to `uint64_t size`, `versionString` at `0x08`, and `version` at `0x24`, removes `unk_24`, and pins the offsets and 40-byte size with independent test `static_assert`s. The TechnicalDebt entry now cites the ProsperoStore caller plus shadPS4, fpPS4, and OpenOrbis; only the console firmware value remains unverified. I rebased the four authored commits onto current `main` (`961b25fe`), rebuilt the Release test target, and `guest_system_configuration` passes (1/1); conventions and diff checks pass. The description now lists no dependency: #2902 and #3218 are independent changes that share the test call site, so whichever merges second may need a small rebase. Please re-review the corrected head when convenient.
pushkarreddyy commented 2026-10-11 06:38:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T06:38:46Z.


Thank you @adriadam10 for the thorough ABI review. All requested changes have been addressed by @MarcZX100 on head 7d39777d:

  • The structure layout now uses a 64-bit size (uint64_t size), versionString at offset 0x08, and version at 0x24, with unk_24 removed.
  • Independent static_assert offset and size checks added to GuestSystemConfiguration.cpp.
  • TechnicalDebt.md citations updated with all 4 sources.
  • Cleanly verified on current main (1690db9a2) with guest_system_configuration passing 100% and Mergeable: True.

cc @oneandonlydean @MarcZX100: Ready for re-review and merge whenever convenient!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106318362 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6106318362). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T06:38:46Z. --- Thank you @adriadam10 for the thorough ABI review. All requested changes have been addressed by @MarcZX100 on head `7d39777d`: - The structure layout now uses a 64-bit size (`uint64_t size`), `versionString` at offset `0x08`, and `version` at `0x24`, with `unk_24` removed. - Independent `static_assert` offset and size checks added to `GuestSystemConfiguration.cpp`. - `TechnicalDebt.md` citations updated with all 4 sources. - Cleanly verified on current `main` (`1690db9a2`) with `guest_system_configuration` passing 100% and `Mergeable: True`. cc @oneandonlydean @MarcZX100: Ready for re-review and merge whenever convenient!
adriadam10 commented 2026-10-11 07:16:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:16:54Z.

Review: APPROVED


Checked the layout against the ProsperoStore caller, shadPS4, fpPS4 and OpenOrbis (u64 size @0, text @8, version @0x24), the EFAULT/EINVAL returns, and the new test (it fails to link without the change). Build and ctest on the area pass; merging.

Added one commit: the TechnicalDebt.md entry now also records that the null/size checks are unverified on a console (shadPS4 returns success for null and never reads size).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5482308869 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#pullrequestreview-5482308869). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T07:16:54Z. **Review:** APPROVED --- Checked the layout against the ProsperoStore caller, shadPS4, fpPS4 and OpenOrbis (u64 size @0, text @8, version @0x24), the EFAULT/EINVAL returns, and the new test (it fails to link without the change). Build and ctest on the area pass; merging. Added one commit: the `TechnicalDebt.md` entry now also records that the null/size checks are unverified on a console (shadPS4 returns success for null and never reads `size`).
Mouhand-Kaddo commented 2026-10-11 07:31:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T07:31:38Z.


Additional platform validation of standalone PR head 9516ca9991b55d1bcd72bc97df6b2b76eb474fb8 (2026-10-11):

Windows: passed — Windows 11, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja; Release, BUILD_TESTING=ON.

1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.

Checks: guest_system_configuration.

Command after building: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^guest_system_configuration$".

No title/gameplay validation. These results cover the standalone head, not a merge with current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106703164 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6106703164). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-11T07:31:38Z. --- <!-- anyps5-platform-validation:9516ca9991b55d1bcd72bc97df6b2b76eb474fb8 --> Additional platform validation of standalone PR head `9516ca9991b55d1bcd72bc97df6b2b76eb474fb8` (2026-10-11): **Windows: passed** — Windows 11, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja; Release, `BUILD_TESTING=ON`. 1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run. Checks: `guest_system_configuration`. Command after building: `ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^guest_system_configuration$"`. No title/gameplay validation. These results cover the standalone head, not a merge with current main.
pushkarreddyy commented 2026-10-11 07:32:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T07:32:48Z.


@MarcZX100 @adriadam10 Just a heads up: PR #3056 (sceKernelGetAppInfo) recently landed on main (bd0692590), introducing a minor 1-line conflict in docs/dev/TechnicalDebt.md. The C++ code in SystemConfiguration.cpp and GuestSystemConfiguration.cpp remains 100% clean and conflict-free. Whenever convenient, a quick rebase onto origin/main will restore mergeability!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106712055 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6106712055). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T07:32:48Z. --- @MarcZX100 @adriadam10 Just a heads up: PR #3056 (`sceKernelGetAppInfo`) recently landed on `main` (`bd0692590`), introducing a minor 1-line conflict in `docs/dev/TechnicalDebt.md`. The C++ code in `SystemConfiguration.cpp` and `GuestSystemConfiguration.cpp` remains 100% clean and conflict-free. Whenever convenient, a quick rebase onto `origin/main` will restore mergeability!
adriadam10 commented 2026-10-11 07:44:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:44:29Z.


Rebased onto current main (only conflict: the TechnicalDebt.md line next to #3056, both entries kept). Diff unchanged; build and guest_system_configuration plus the area's ctest pass; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106800256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2945#issuecomment-6106800256). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T07:44:29Z. --- Rebased onto current `main` (only conflict: the `TechnicalDebt.md` line next to #3056, both entries kept). Diff unchanged; build and `guest_system_configuration` plus the area's ctest pass; merging.
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!2945
No description provided.