Memory: remove unused VirtualToPhysical
This commit is contained in:
parent
1388a44c41
commit
9e8d149ca7
@ -795,36 +795,6 @@ void WriteMMIO<u64>(MMIORegionPointer mmio_handler, VAddr addr, const u64 data)
|
|||||||
mmio_handler->Write64(addr, data);
|
mmio_handler->Write64(addr, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<PAddr> 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) {
|
u32 GetFCRAMOffset(u8* pointer) {
|
||||||
ASSERT(pointer >= fcram.data() && pointer < fcram.data() + fcram.size());
|
ASSERT(pointer >= fcram.data() && pointer < fcram.data() + fcram.size());
|
||||||
return pointer - fcram.data();
|
return pointer - fcram.data();
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <optional>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@ -214,20 +213,6 @@ u8* GetPointer(VAddr vaddr);
|
|||||||
|
|
||||||
std::string ReadCString(VAddr vaddr, std::size_t max_length);
|
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<PAddr> 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.
|
* Gets a pointer to the memory region beginning at the specified physical address.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user