diff options
Diffstat (limited to 'src/core/hle/kernel/shared_memory.cpp')
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 0cd467110..67d748561 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -4,6 +4,7 @@ #include "common/assert.h" #include "core/core.h" +#include "core/hle/kernel/k_scoped_resource_reservation.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory/page_table.h" #include "core/hle/kernel/shared_memory.h" @@ -21,6 +22,11 @@ std::shared_ptr<SharedMemory> SharedMemory::Create( Memory::MemoryPermission user_permission, PAddr physical_address, std::size_t size, std::string name) { + const auto resource_limit = kernel.GetSystemResourceLimit(); + KScopedResourceReservation memory_reservation(resource_limit, LimitableResource::PhysicalMemory, + size); + ASSERT(memory_reservation.Succeeded()); + std::shared_ptr<SharedMemory> shared_memory{ std::make_shared<SharedMemory>(kernel, device_memory)}; @@ -32,6 +38,7 @@ std::shared_ptr<SharedMemory> SharedMemory::Create( shared_memory->size = size; shared_memory->name = name; + memory_reservation.Commit(); return shared_memory; } |