diff options
author | bunnei <bunneidev@gmail.com> | 2022-12-28 23:28:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-28 23:28:31 +0100 |
commit | 60419dd35e8d6dec97ec12839b5b9910167315d2 (patch) | |
tree | 95b7ee20365996ee1b3aae93c254343b9b496181 /src/core/hle/kernel/k_shared_memory.cpp | |
parent | Merge pull request #9490 from ameerj/texture-cache-prealloc (diff) | |
parent | k_page_table: remove HACK_OpenPages/ClosePages (diff) | |
download | yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.tar yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.tar.gz yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.tar.bz2 yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.tar.lz yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.tar.xz yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.tar.zst yuzu-60419dd35e8d6dec97ec12839b5b9910167315d2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_shared_memory.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/hle/kernel/k_shared_memory.cpp b/src/core/hle/kernel/k_shared_memory.cpp index 0aa68103c..3cf2b5d91 100644 --- a/src/core/hle/kernel/k_shared_memory.cpp +++ b/src/core/hle/kernel/k_shared_memory.cpp @@ -13,10 +13,7 @@ namespace Kernel { KSharedMemory::KSharedMemory(KernelCore& kernel_) : KAutoObjectWithSlabHeapAndContainer{kernel_} {} - -KSharedMemory::~KSharedMemory() { - kernel.GetSystemResourceLimit()->Release(LimitableResource::PhysicalMemoryMax, size); -} +KSharedMemory::~KSharedMemory() = default; Result KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProcess* owner_process_, Svc::MemoryPermission owner_permission_, @@ -49,7 +46,8 @@ Result KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProcess* o R_UNLESS(physical_address != 0, ResultOutOfMemory); //! Insert the result into our page group. - page_group.emplace(physical_address, num_pages); + page_group.emplace(kernel, &kernel.GetSystemSystemResource().GetBlockInfoManager()); + page_group->AddBlock(physical_address, num_pages); // Commit our reservation. memory_reservation.Commit(); @@ -62,7 +60,7 @@ Result KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProcess* o is_initialized = true; // Clear all pages in the memory. - for (const auto& block : page_group->Nodes()) { + for (const auto& block : *page_group) { std::memset(device_memory_.GetPointer<void>(block.GetAddress()), 0, block.GetSize()); } @@ -71,13 +69,8 @@ Result KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProcess* o void KSharedMemory::Finalize() { // Close and finalize the page group. - // page_group->Close(); - // page_group->Finalize(); - - //! HACK: Manually close. - for (const auto& block : page_group->Nodes()) { - kernel.MemoryManager().Close(block.GetAddress(), block.GetNumPages()); - } + page_group->Close(); + page_group->Finalize(); // Release the memory reservation. resource_limit->Release(LimitableResource::PhysicalMemoryMax, size); |