From b199b7ada9e115e21478cb199576858034e34036 Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Tue, 20 Nov 2018 22:52:44 -0500 Subject: [PATCH] Memory: move GetFCRAMOffset into MemorySystem --- src/core/hle/kernel/process.cpp | 2 +- src/core/memory.cpp | 2 +- src/core/memory.h | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 235d140439..62b0caea12 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -218,7 +218,7 @@ ResultCode Process::HeapFree(VAddr target, u32 size) { // Free heaps block by block CASCADE_RESULT(auto backing_blocks, vm_manager.GetBackingBlocksForRange(target, size)); for (const auto [backing_memory, block_size] : backing_blocks) { - memory_region->Free(Memory::GetFCRAMOffset(backing_memory), block_size); + memory_region->Free(kernel.memory.GetFCRAMOffset(backing_memory), block_size); } ResultCode result = vm_manager.UnmapRange(target, size); diff --git a/src/core/memory.cpp b/src/core/memory.cpp index f589c765a2..3326fc718b 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -739,7 +739,7 @@ void WriteMMIO(MMIORegionPointer mmio_handler, VAddr addr, const u64 data) mmio_handler->Write64(addr, data); } -u32 GetFCRAMOffset(u8* pointer) { +u32 MemorySystem::GetFCRAMOffset(u8* pointer) { ASSERT(pointer >= fcram.data() && pointer < fcram.data() + fcram.size()); return pointer - fcram.data(); } diff --git a/src/core/memory.h b/src/core/memory.h index d5c669a262..3cb94dddca 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -251,11 +251,10 @@ enum class FlushMode { */ void RasterizerFlushVirtualRegion(VAddr start, u32 size, FlushMode mode); -/// Gets offset in FCRAM from a pointer inside FCRAM range -u32 GetFCRAMOffset(u8* pointer); - class MemorySystem { - +public: + /// Gets offset in FCRAM from a pointer inside FCRAM range + u32 GetFCRAMOffset(u8* pointer); }; } // namespace Memory