diff options
author | bunnei <bunneidev@gmail.com> | 2022-03-31 03:23:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 03:23:37 +0200 |
commit | 365c6ad75343c19a650873005bb9ea36417f8c7b (patch) | |
tree | 6b76fe666afea621b14dcc93b7cb46081b529213 /src/core/hle/kernel/svc.cpp | |
parent | Merge pull request #8107 from german77/fullscreen (diff) | |
parent | hle: kernel: k_page_table: Fix implementations of LockForCodeMemory & UnlockForCodeMemory. (diff) | |
download | yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.tar yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.tar.gz yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.tar.bz2 yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.tar.lz yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.tar.xz yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.tar.zst yuzu-365c6ad75343c19a650873005bb9ea36417f8c7b.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 839171e85..976d63234 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1362,8 +1362,11 @@ static ResultCode MapProcessMemory(Core::System& system, VAddr dst_address, Hand ResultInvalidMemoryRegion); // Create a new page group. - KMemoryInfo kBlockInfo = dst_pt.QueryInfo(dst_address); - KPageLinkedList pg(kBlockInfo.GetAddress(), kBlockInfo.GetNumPages()); + KPageLinkedList pg; + R_TRY(src_pt.MakeAndOpenPageGroup( + std::addressof(pg), src_address, size / PageSize, KMemoryState::FlagCanMapProcess, + KMemoryState::FlagCanMapProcess, KMemoryPermission::None, KMemoryPermission::None, + KMemoryAttribute::All, KMemoryAttribute::None)); // Map the group. R_TRY(dst_pt.MapPages(dst_address, pg, KMemoryState::SharedCode, @@ -1408,8 +1411,8 @@ static ResultCode UnmapProcessMemory(Core::System& system, VAddr dst_address, Ha } static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { - LOG_TRACE(Kernel_SVC, "called, handle_out={}, address=0x{:X}, size=0x{:X}", - static_cast<void*>(out), address, size); + LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); + // Get kernel instance. auto& kernel = system.Kernel(); @@ -1664,7 +1667,7 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha return ResultInvalidAddress; } - if (size == 0 || Common::Is4KBAligned(size)) { + if (size == 0 || !Common::Is4KBAligned(size)) { LOG_ERROR(Kernel_SVC, "Size is zero or not page-aligned (size=0x{:016X}).", size); return ResultInvalidSize; } |