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.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index a161a8204..5878b99dc 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -23,10 +23,12 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) {
// 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.
- if ((addr >= VRAM_PADDR) && (addr < VRAM_PADDR_END)) {
+ 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 + FCRAM_VADDR;
+ } else if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
+ return addr - FCRAM_PADDR + HEAP_LINEAR_VADDR;
}
LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr);
@@ -39,10 +41,12 @@ PAddr VirtualToPhysicalAddress(const VAddr addr) {
// 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.
- if ((addr >= VRAM_VADDR) && (addr < VRAM_VADDR_END)) {
- return addr - 0x07000000;
- } else if ((addr >= FCRAM_VADDR) && (addr < FCRAM_VADDR_END)) {
- return addr - FCRAM_VADDR + FCRAM_PADDR;
+ if (addr == 0) {
+ return 0;
+ } else if ((addr >= VRAM_VADDR) && (addr < VRAM_VADDR_END)) {
+ return addr - VRAM_VADDR + VRAM_PADDR;
+ } else if ((addr >= HEAP_LINEAR_VADDR) && (addr < HEAP_LINEAR_VADDR_END)) {
+ return addr - HEAP_LINEAR_VADDR + FCRAM_PADDR;
}
LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr);