From 9e8d149ca7511285a362a0a3188d85ba65cb5b8b Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Tue, 13 Nov 2018 00:19:16 -0500 Subject: [PATCH] Memory: remove unused VirtualToPhysical --- src/core/memory.cpp | 30 ------------------------------ src/core/memory.h | 15 --------------- 2 files changed, 45 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 8f082413d..2594678e0 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -795,36 +795,6 @@ void WriteMMIO(MMIORegionPointer mmio_handler, VAddr addr, const u64 data) mmio_handler->Write64(addr, data); } -std::optional TryVirtualToPhysicalAddress(const VAddr addr) { - if (addr == 0) { - return 0; - } else if (addr >= VRAM_VADDR && addr < VRAM_VADDR_END) { - return addr - VRAM_VADDR + VRAM_PADDR; - } else if (addr >= LINEAR_HEAP_VADDR && addr < LINEAR_HEAP_VADDR_END) { - return addr - LINEAR_HEAP_VADDR + FCRAM_PADDR; - } else if (addr >= NEW_LINEAR_HEAP_VADDR && addr < NEW_LINEAR_HEAP_VADDR_END) { - return addr - NEW_LINEAR_HEAP_VADDR + FCRAM_PADDR; - } else if (addr >= DSP_RAM_VADDR && addr < DSP_RAM_VADDR_END) { - return addr - DSP_RAM_VADDR + DSP_RAM_PADDR; - } else if (addr >= IO_AREA_VADDR && addr < IO_AREA_VADDR_END) { - return addr - IO_AREA_VADDR + IO_AREA_PADDR; - } else if (addr >= N3DS_EXTRA_RAM_VADDR && addr < N3DS_EXTRA_RAM_VADDR_END) { - return addr - N3DS_EXTRA_RAM_VADDR + N3DS_EXTRA_RAM_PADDR; - } - - return {}; -} - -PAddr VirtualToPhysicalAddress(const VAddr addr) { - auto paddr = TryVirtualToPhysicalAddress(addr); - if (!paddr) { - LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x{:08X}", addr); - // To help with debugging, set bit on address so that it's obviously invalid. - return addr | 0x80000000; - } - return *paddr; -} - u32 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 58e8a6a80..aaa44aaa1 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -6,7 +6,6 @@ #include #include -#include #include #include #include "common/common_types.h" @@ -214,20 +213,6 @@ u8* GetPointer(VAddr vaddr); std::string ReadCString(VAddr vaddr, std::size_t max_length); -/** - * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical - * address. This should be used by services to translate addresses for use by the hardware. - */ -std::optional TryVirtualToPhysicalAddress(VAddr addr); - -/** - * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical - * address. This should be used by services to translate addresses for use by the hardware. - * - * @deprecated Use TryVirtualToPhysicalAddress(), which reports failure. - */ -PAddr VirtualToPhysicalAddress(VAddr addr); - /** * Gets a pointer to the memory region beginning at the specified physical address. */