From 44acb30d60a960054ce8c11e6c7b43f0068e3d25 Mon Sep 17 00:00:00 2001 From: DH Date: Sun, 24 Nov 2024 14:11:12 +0300 Subject: [PATCH] kernel: sysctl: add hw.sce_main_socid --- orbis-kernel/src/sys/sys_sysctl.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/orbis-kernel/src/sys/sys_sysctl.cpp b/orbis-kernel/src/sys/sys_sysctl.cpp index 7cf925511..6c29d1fca 100644 --- a/orbis-kernel/src/sys/sys_sysctl.cpp +++ b/orbis-kernel/src/sys/sys_sysctl.cpp @@ -37,6 +37,7 @@ SysResult kern_sysctl(Thread *thread, ptr name, uint namelen, // FIXME config = 1000, + sce_main_socid, }; enum sysctl_vm { @@ -562,6 +563,18 @@ SysResult kern_sysctl(Thread *thread, ptr name, uint namelen, dest[count++] = vm; dest[count++] = budgets; dest[count++] = mlock_avail; + } else if (searchName == "hw.sce_main_socid") { + if (g_context.fwType != FwType::Ps5) { + return ErrorCode::INVAL; + } + + if (*oldlenp < 2 * sizeof(uint32_t)) { + std::fprintf(stderr, " %s error\n", searchName.data()); + return ErrorCode::INVAL; + } + + dest[count++] = hw; + dest[count++] = sce_main_socid; } if (count == 0) { @@ -753,6 +766,17 @@ SysResult kern_sysctl(Thread *thread, ptr name, uint namelen, *(uint32_t *)old = 0x4000; return {}; + case sysctl_hw::sce_main_socid: + if (g_context.fwType != FwType::Ps5) { + return ErrorCode::INVAL; + } + if (*oldlenp != 4 || new_ != nullptr || newlen != 0) { + return ErrorCode::INVAL; + } + + *(uint32_t *)old = 0x840f50; + return {}; + case sysctl_hw::ncpu: if (*oldlenp != 4 || new_ != nullptr || newlen != 0) {