summaryrefslogtreecommitdiffstats
path: root/src/core/mem_map_funcs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/mem_map_funcs.cpp')
-rw-r--r--src/core/mem_map_funcs.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index f96ae6e9e..a8e0fed07 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -18,40 +18,40 @@ namespace Memory {
static std::map<u32, MemoryBlock> heap_map;
static std::map<u32, MemoryBlock> heap_linear_map;
-/// Convert a physical address to virtual address
-VAddr PhysicalToVirtualAddress(const PAddr addr) {
- // Our memory interface read/write functions assume virtual addresses. Put any physical address
- // to virtual address translations here. This is quite hacky, but necessary until we implement
- // proper MMU emulation.
- // TODO: Screw it, I'll let bunnei figure out how to do this properly.
+PAddr VirtualToPhysicalAddress(const VAddr addr) {
if (addr == 0) {
return 0;
- } else if ((addr >= VRAM_PADDR) && (addr < VRAM_PADDR_END)) {
- return addr - VRAM_PADDR + VRAM_VADDR;
- } else if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
- return addr - FCRAM_PADDR + LINEAR_HEAP_VADDR;
+ } 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 >= 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;
}
- LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr);
- return addr;
+ 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;
}
-/// Convert a physical address to virtual address
-PAddr VirtualToPhysicalAddress(const VAddr addr) {
- // Our memory interface read/write functions assume virtual addresses. Put any physical address
- // to virtual address translations here. This is quite hacky, but necessary until we implement
- // proper MMU emulation.
- // TODO: Screw it, I'll let bunnei figure out how to do this properly.
+VAddr PhysicalToVirtualAddress(const PAddr 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 >= VRAM_PADDR && addr < VRAM_PADDR_END) {
+ return addr - VRAM_PADDR + VRAM_VADDR;
+ } else if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) {
+ return addr - FCRAM_PADDR + LINEAR_HEAP_VADDR;
+ } else if (addr >= DSP_RAM_PADDR && addr < DSP_RAM_PADDR_END) {
+ return addr - DSP_RAM_PADDR + DSP_RAM_VADDR;
+ } else if (addr >= IO_AREA_PADDR && addr < IO_AREA_PADDR_END) {
+ return addr - IO_AREA_PADDR + IO_AREA_VADDR;
}
- LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr);
- return addr;
+ LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr);
+ // To help with debugging, set bit on address so that it's obviously invalid.
+ return addr | 0x80000000;
}
template <typename T>