From af4f08be339a2ba093578e7083638a95d847fb9d Mon Sep 17 00:00:00 2001 From: Zephyron Date: Thu, 6 Mar 2025 06:42:48 +0000 Subject: revert 6565055865688ba316801d99a3c3a5a0300cad5d revert Fix: Core_Memory logging and ARM_NCE Mutex logging --- src/core/memory.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/core/memory.cpp') diff --git a/src/core/memory.cpp b/src/core/memory.cpp index b32071899..dd6ffaf6c 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -27,7 +27,6 @@ #include "video_core/host1x/gpu_device_memory_manager.h" #include "video_core/host1x/host1x.h" #include "video_core/rasterizer_download_area.h" -#include "core/arm/nce/arm_nce.h" namespace Core::Memory { @@ -1152,7 +1151,7 @@ bool Memory::InvalidateSeparateHeap(void* fault_address) { #endif } -bool Memory::Remap(u64 guest_addr, u32 size, ArmNce& arm_nce) { +bool Memory::Remap(u64 guest_addr, u32 size) { // Unmap the old address UnmapRegion(*impl->current_page_table, guest_addr, size, false); @@ -1162,7 +1161,7 @@ bool Memory::Remap(u64 guest_addr, u32 size, ArmNce& arm_nce) { // Allocate new memory void* new_memory = std::malloc(size); if (!new_memory) { - LOG_ERROR(Core_ARM, "Failed to allocate new memory for remapping address {:X}", guest_addr); + LOG_ERROR(Core_Memory, "Failed to allocate new memory for remapping address {:X}", guest_addr); return false; } @@ -1171,7 +1170,7 @@ bool Memory::Remap(u64 guest_addr, u32 size, ArmNce& arm_nce) { // Verify the mapping if (GetPointer(guest_addr) != nullptr) { - LOG_INFO(Core_ARM, "Successfully remapped address {:X}", guest_addr); + LOG_INFO(Core_Memory, "Successfully remapped address {:X}", guest_addr); return true; } else { LOG_ERROR(Core_Memory, "Failed to remap address {:X}", guest_addr); @@ -1180,12 +1179,10 @@ bool Memory::Remap(u64 guest_addr, u32 size, ArmNce& arm_nce) { } } -void Memory::ReclaimUnusedMemory(ArmNce& arm_nce) { - std::lock_guard lock(arm_nce.m_tlb_mutex); // Correct usage of lock_guard +void Memory::ReclaimUnusedMemory() { + std::lock_guard lock(m_tlb_mutex); - const auto& tlb_entries = arm_nce.GetTlbEntries(); - - for (const auto& entry : tlb_entries) { + for (auto& entry : m_tlb) { if (entry.valid && entry.ref_count == 0) { // Unmap the memory region UnmapRegion(*impl->current_page_table, entry.guest_addr, entry.size, false); @@ -1194,7 +1191,7 @@ void Memory::ReclaimUnusedMemory(ArmNce& arm_nce) { std::free(reinterpret_cast(entry.host_addr)); // Invalidate the TLB entry - const_cast(entry).valid = false; + entry.valid = false; LOG_INFO(Core_Memory, "Reclaimed memory for address {:X}", entry.guest_addr); } -- cgit v1.2.3