libkernel: Implement sceKernelEnableDmemAliasing, proper mapping type checks in posix_mmap #3859
+43
−5
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.
This PR includes proper checks for dmem aliasing (implemented in a naive way for now), and adds three flags to Core::MemoryMapFlags for determining memory type.
For mmap, flag Anon signifies mappings with no backing (flex mem), flag Stack is for mapping stack memory, and flag Void is for reserving memory. These can all be verified through decompiling libkernel, as it uses these flags for mmap calls in the relevant kernel functions.
This PR needs regression testing, primarily in titles with SDK version at or above 2.50. I don't have access to the wider range of games I own, so I can't really test this myself.
Would also be nice to have someone test Red Dead Redemption 2, it is the only game I've seen sceKernelEnableDmemAliasing called in, but I can't test it right now.