fix(libkernel_sys): return what the firmware returns from 20 calls it does not implement #9172
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9172"
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 hypermoist on 2026-10-21T14:13:04Z.
What
These 20 libkernel_sys exports were
NotImplementedstubs. Inlibkernel_sys.sprx(firmware 13.60, read from disassembly, not measured on a console) each is a single constant return. None makes a syscall or reads its arguments, so the exports now return the same value. This follows #8303, #8305 and #8307.libkernel_sys.sprxpthread_switch_add_npQ9DhUQxNCwI0xfb40mov eax, 0x2d; retENOTSUP)pthread_switch_delete_npneZ60m-+Baw0xfb50mov eax, 0x2d; retENOTSUP)sceKernelAddResourceuqJlNd9XIrA0x46ca0xor eax, eax; retsceKernelEventLogInitc7noapHDHWU0x28f90xor eax, eax; retsceKernelIsGenuineKratosCexH54cSDvjryI0x1f160xor eax, eax; retsceKernelReleaseTraceDirectMemoryAlqa9RE0Y5k0x1aaf0xor eax, eax; retsceKernelHasNeoModerNRtm1uioyY0x20af0mov eax, 1; retsceKernelIsAuthenticNeocbn9Di01j0k0x20b00mov eax, 1; retsceKernelIsGenuineNu3h77G+tFVc0x1f540mov eax, 1; retsceKernelCreateEportKF25CDxFn480x2bd80mov eax, 0x80020001; ret0x80020001(EPERM)sceKernelDeleteEportHhGAQ+ffliw0x2bd90mov eax, 0x80020001; ret0x80020001(EPERM)sceKernelTriggerEportis-XQhYPRaQ0x2bda0mov eax, 0x80020001; ret0x80020001(EPERM)sceKernelOpenEportwibWed78GyY0x2bdb0mov eax, 0x80020001; ret0x80020001(EPERM)sceKernelCloseEportJ5RqzZ7nMVc0x2bdc0mov eax, 0x80020001; ret0x80020001(EPERM)sceKernelQueryTraceMemory+8GCeq43o7c0x1a710mov eax, 0x80020002; ret0x80020002(ENOENT)sceKernelIccGetCPMode1NlbNxWzn7U0x26d90mov eax, 0x8002002d; ret0x8002002d(ENOTSUP)sceKernelIccSetCPModehc0GFWwSrR40x26da0mov eax, 0x8002002d; ret0x8002002d(ENOTSUP)sceKernelClearGameDirectMemoryEgJqC+9VmvM0x19b40mov eax, 0x8002004e; ret0x8002004e(ENOSYS)sceKernelMapTraceMemoryDpDnfM6StzA0x1a6f0mov eax, 0x8002004e; ret0x8002004e(ENOSYS)sceKernelTraceMemoryTypeProtecteESTogkCMPE0x1a720mov eax, 0x8002004e; ret0x8002004e(ENOSYS)Left out:
get_module_info_list, which returns the address of module data rather than a constant.Tested
Linux (CachyOS, GCC), merged with current
main: libkernel_sys builds. The newguest_kernel_sys_constantstest (core/libs/tests/GuestKernelSysConstants.cpp) calls all 20 exports and checks each exact return; it passes, as doguest_kernel_sysandguest_kernel_sys_thread_defaults.check_conventionsandpr_overlappass. #9134 removes the stub aftersceKernelCloseEport; the two hunks are separated by unchanged lines, so both merge cleanly. No title was run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:28:29Z.
Review: DISMISSED
Review
The changed wrappers are still argumentless and return the constants shown in the description. I did not find a source-level defect in the edited bodies. I’m requesting changes for missing direct regression coverage and reviewable firmware evidence.
Tests for the new returns
I searched
core/libs/testsfor all 20 export names in this PR and found no references. The reportedguest_kernel_syspass is useful for the library, but the current tests do not check these new return values.Please add focused checks that call the 20 exports and assert their exact returns (grouping by constant is fine), then rerun
guest_kernel_sys. This protects the newly implemented behavior and ensures the changed symbols are linked by a test.Firmware evidence
The table identifies firmware 12.00 and the instruction pattern for each return group, but does not give a module offset or attached listing. Please include the
libkernel_sys.sprxfunction offsets or a concise disassembly excerpt for each group so reviewers can verify the constants. Keep the note that console behavior has not been measured.Base and overlaps
The head is 608 commits behind current
main(merge base663de1ab21, from 2026-10-21 13:56 UTC). Please update it to currentmainand rerun the focused test as CONTRIBUTING requires branches to stay current.I checked the generated file-level overlap list against the changed exports. #8987, #9019, #9040, #9103, #9141, #9294, and #9382 touch other exports in the same source file; I found no duplicate export or shared changed hunk. #9134 removes the adjacent
sceKernelCloseEventFlagstub, notsceKernelCloseEport, so that is separate too. I found no dependency that needs adding.Checks
git diff --checkagainst currentmain: passed.tools/check_conventions.pyagainst currentmain: passed.guest_kernel_syspass is author-reported on the older base.The firmware-derived values look consistent as implemented; direct assertions and reviewable source evidence are needed before approval.
Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T08:47:05Z.
@MarcZX10 thanks, all three addressed:
guest_kernel_sys_constants(core/libs/tests/GuestKernelSysConstants.cpp) calls each of the 20 exports and checks its exact return. It passes on Linux together withguest_kernel_sysandguest_kernel_sys_thread_defaults.libkernel_sys.sprx(firmware 12.00) next to its two-instruction body. It still says the values are read from disassembly and not measured on a console.main(928094e49d) before running the tests.