diff options
| author | 2019-07-11 01:38:28 -0700 | |
|---|---|---|
| committer | 2019-07-11 01:38:28 -0700 | |
| commit | 072a9796f51a11a72c71f415562fdfd7fe6af6d3 (patch) | |
| tree | 9e653f206c6668f04d14a9d96e35ad1fee563ff7 /src/core/hle/kernel/svc.cpp | |
| parent | Merge pull request #2714 from DarkLordZach/repo-sync-pipeline (diff) | |
| download | yuzu-072a9796f51a11a72c71f415562fdfd7fe6af6d3.tar.gz yuzu-072a9796f51a11a72c71f415562fdfd7fe6af6d3.tar.xz yuzu-072a9796f51a11a72c71f415562fdfd7fe6af6d3.zip | |
Restore memory perms on svcUnmapMemory/UnloadNro
Prior to PR, Yuzu did not restore memory to RW-
on unmap of mirrored memory or unloading of NRO.
(In fact, in the NRO case, the memory was unmapped
instead of reprotected to --- on Load, so it was
actually lost entirely...)
This PR addresses that, and restores memory to RW-
as it should.
This fixes a crash in Super Smash Bros when creating
a World of Light save for the first time, and possibly
other games/circumstances.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 332573a95..58374f829 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -318,7 +318,14 @@ static ResultCode UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_ad | |||
| 318 | return result; | 318 | return result; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | return vm_manager.UnmapRange(dst_addr, size); | 321 | const auto unmap_res = vm_manager.UnmapRange(dst_addr, size); |
| 322 | |||
| 323 | // Reprotect the source mapping on success | ||
| 324 | if (unmap_res.IsSuccess()) { | ||
| 325 | ASSERT(vm_manager.ReprotectRange(src_addr, size, VMAPermission::ReadWrite).IsSuccess()); | ||
| 326 | } | ||
| 327 | |||
| 328 | return unmap_res; | ||
| 322 | } | 329 | } |
| 323 | 330 | ||
| 324 | /// Connect to an OS service given the port name, returns the handle to the port to out | 331 | /// Connect to an OS service given the port name, returns the handle to the port to out |