diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-01-10 21:27:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 21:27:33 +0100 |
commit | cbcf210c19b3661e0edda03f22ef323cb5b30c26 (patch) | |
tree | f48957b563b25e43c180ada20c144f5a4749bdca /src/core/hle/kernel/k_shared_memory.cpp | |
parent | Merge pull request #9601 from liamwhite/it-never-ends (diff) | |
parent | Revert "Revert "k_page_group: synchronize"" (diff) | |
download | yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.tar yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.tar.gz yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.tar.bz2 yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.tar.lz yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.tar.xz yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.tar.zst yuzu-cbcf210c19b3661e0edda03f22ef323cb5b30c26.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); |