summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-01-15 08:20:30 +0100
committerbunnei <bunneidev@gmail.com>2022-01-22 10:33:26 +0100
commit0137f2e6e11056db9c4ff5af6dc988e69823949e (patch)
treeacf43fca8dbaeee5d19c8fc7071d4c13771e6c09 /src/core
parentcore: hle: kernel: Refactor Un/MapPhysicalMemory to remove unnecessary methods. (diff)
downloadyuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.tar
yuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.tar.gz
yuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.tar.bz2
yuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.tar.lz
yuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.tar.xz
yuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.tar.zst
yuzu-0137f2e6e11056db9c4ff5af6dc988e69823949e.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/k_page_table.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp
index 5ec183b9e..04276ab32 100644
--- a/src/core/hle/kernel/k_page_table.cpp
+++ b/src/core/hle/kernel/k_page_table.cpp
@@ -885,6 +885,9 @@ ResultCode KPageTable::SetMaxHeapSize(std::size_t size) {
}
ResultCode KPageTable::SetHeapSize(VAddr* out, std::size_t size) {
+ // Lock the physical memory lock.
+ std::lock_guard phys_lk(map_physical_memory_lock);
+
// Try to perform a reduction in heap, instead of an extension.
VAddr cur_address{};
std::size_t allocation_size{};
@@ -1014,12 +1017,12 @@ ResultVal<VAddr> KPageTable::AllocateAndMapMemory(std::size_t needed_num_pages,
}
if (is_map_only) {
- CASCADE_CODE(Operate(addr, needed_num_pages, perm, OperationType::Map, map_addr));
+ R_TRY(Operate(addr, needed_num_pages, perm, OperationType::Map, map_addr));
} else {
KPageLinkedList page_group;
- CASCADE_CODE(system.Kernel().MemoryManager().Allocate(page_group, needed_num_pages,
- memory_pool, allocation_option));
- CASCADE_CODE(Operate(addr, needed_num_pages, page_group, OperationType::MapGroup));
+ R_TRY(system.Kernel().MemoryManager().Allocate(page_group, needed_num_pages, memory_pool,
+ allocation_option));
+ R_TRY(Operate(addr, needed_num_pages, page_group, OperationType::MapGroup));
}
block_manager->Update(addr, needed_num_pages, state, perm);