Repository navigation
feat(libkernel): implement sceKernelIsStack - #702
Merged
Merged
Conversation
Track the stack range of each running guest thread and answer sceKernelIsStack from the calling thread's stack (the host limits for an adopted thread) or from that registry. A mapped address outside every stack succeeds with null bounds and an unmapped one returns EACCES; the output pointers may be null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
Collaborator
|
Thanks for this. It needs a rebase now that #761 has landed. Both change the same part of |
…/kernel-is-stack # Conflicts: # core/libs/prx/libkernel/Pthread/src/Thread.cpp
Contributor
Author
|
Merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
sceKernelIsStack(addr, start, end)threwnot implemented.Thread.cppkeeps the stack range of every running guest thread: registered inRunThread(the guest range on Windows, the host range on Linux, wherestackAddressis not set) and removed infinishThread.GuestThreadStackanswers from the calling thread's stack first (its guest range, or the host limits for an adopted thread such as the main thread), then from the registry.sceKernelIsStack: an address in a stack returns its bounds; a mapped address outside every stack succeeds with null bounds; an addresssceKernelVirtualQueryrejects returnsSCE_KERNEL_ERROR_EACCES. Nullstart/endare allowed. The non-stack and unmapped results follow shadPS4'sMemoryManager::IsStack.guest_kernel_is_stack: main thread stack, a running worker's stack queried from the worker and from the main thread (disjoint from the main stack), a global, null outputs, a mapped and then unmapped flexible page.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Ryzen 7 9800X3D, Radeon RX 9070 XT.
ctest: 288/290 passed, includingguest_kernel_is_stack.agc_driver_lds_atomics64andagc_driver_vopc_compare_tablefail on this machine onmainas well (Vulkan device tests).sceKernelIsStackafter readingRuntimeInitializeOnLoads.json, then continues toScriptingAssemblies.jsonand VideoOut setup.Not tested on Linux.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code