feat(libkernel): stop at start-up on a host CPU without the PS5's extensions #5705
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5705"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T07:30:59Z.
What
Addresses #3719. Titles run natively, so a host CPU that lacks an extension the PS5's Zen 2 has stops with an illegal instruction somewhere inside the title; in #3719 that is
shlx(BMI2) in the title's libc, and the log does not say why.libkernel now reads CPUID (leaves 1, 7, 0xD.1, 0x80000001, 0x80000008) and XCR0 when it loads on a Linux or Windows x86-64 host, logs which of the Zen 2 user-mode extensions the host has, and throws before any title code runs if one is missing that compiled code uses without checking, naming the host CPU and the missing extensions:
Required: the extensions LLVM selects from plain C/C++ for
-march=znver2(LLVM's Zen 2 feature list): SSE to SSE4.2, SSSE3, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, plus the OS's AVX state in XCR0. Logged only: SSE4A, CLZERO and SHA (--to-intelconverts them) and the extensions compilers emit only for intrinsics or explicit prefetches (AES, PCLMULQDQ, RDRAND, RDSEED, ADX, CLFLUSHOPT, CLWB, RDPID, XSAVEOPT, XSAVEC, PREFETCHW). macOS is not checked: Rosetta runs AVX2, FMA, BMI1/2, F16C and MOVBE without reporting them through CPUID. Both limits are in TechnicalDebt.The CPUID brand-string reader moves from
SystemConfiguration.cpp(hw.model) toHostCpu.cppand is shared.Tested
Linux, GCC, i9-14900KF:
host_cpu(new) feeds fake CPUID/XCR0 values to the comparison: a Zen 2 set and an AVX2 Intel set without the AMD-only and intrinsic-only extensions pass; clearing any one required bit (BMI2, BMI1, AVX2, MOVBE, FMA, F16C, POPCNT, SSE4.2, CMPXCHG16B, LZCNT, LAHF/SAHF) reports exactly that one; an AVX-only host reports LZCNT, BMI1, BMI2, MOVBE, AVX2, FMA; XCR0 without YMM state or OSXSAVE clear reports the OS AVX state; the error names the CPU (trailing brand padding trimmed, empty brand as "unknown model").ctest: 1107/1107 passed (the start-up line appears in every libkernel test's output).host CPU Intel(R) Core(TM) i9-14900KF: has SSE, ..., OS AVX state (XCR0); lacks SSE4A, CLZERO.python tools/check_conventions.py --base origin/mainpassed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (none added).mdfiles or images added to the repository