Memory: move GetFCRAMOffset into MemorySystem

This commit is contained in:
Weiyi Wang 2018-11-20 22:52:44 -05:00
parent 8118be6615
commit b199b7ada9
3 changed files with 5 additions and 6 deletions

View File

@ -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);

View File

@ -739,7 +739,7 @@ void WriteMMIO<u64>(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();
}

View File

@ -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