From 8bfda0d84dc4fc2f437556413330e209c44b0298 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Wed, 11 Jan 2023 21:53:48 +0530 Subject: [PATCH] Fix hole punching in mappings with SVC `UnmapPhysicalMemory` Certain titles such as Super Smash Bros Ultimate can use SVC `UnmapPhysicalMemory` to punch holes into physical memory mappings, this wasn't handled correctly as we completely deleted the portion after the hole. It has now been fixed which results in these titles which depend on this behavior to work now. --- app/src/main/cpp/skyline/kernel/svc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/cpp/skyline/kernel/svc.cpp b/app/src/main/cpp/skyline/kernel/svc.cpp index 604533d0..a3aa5a20 100644 --- a/app/src/main/cpp/skyline/kernel/svc.cpp +++ b/app/src/main/cpp/skyline/kernel/svc.cpp @@ -1084,6 +1084,9 @@ namespace skyline::kernel::svc { } } else if (memory->guest.data() < pointer) { memory->Resize(static_cast(pointer - memory->guest.data())); + + if (memory->guest.data() + initialSize > end) + state.process->NewHandle(span{end, static_cast(memory->guest.data() + initialSize - end)}, memory::Permission{true, true, false}, memory::states::Heap); } } pointer += initialSize;