summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/mem_map.h14
-rw-r--r--src/core/mem_map_funcs.cpp2
2 files changed, 15 insertions, 1 deletions
diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index 1a49cc98d..c744e377e 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -53,7 +53,9 @@ enum {
HARDWARE_IO_PADDR_END = (HARDWARE_IO_PADDR + HARDWARE_IO_SIZE),
HARDWARE_IO_VADDR_END = (HARDWARE_IO_VADDR + HARDWARE_IO_SIZE),
+ VRAM_PADDR = 0x18000000,
VRAM_VADDR = 0x1F000000,
+ VRAM_PADDR_END = (VRAM_PADDR + VRAM_SIZE),
VRAM_VADDR_END = (VRAM_VADDR + VRAM_SIZE),
SCRATCHPAD_VADDR_END = 0x10000000,
@@ -141,4 +143,16 @@ inline const char* GetCharPointer(const u32 address) {
return (const char *)GetPointer(address);
}
+inline const u32 VirtualAddressFromPhysical_FCRAM(const u32 address) {
+ return ((address & FCRAM_MASK) | FCRAM_VADDR);
+}
+
+inline const u32 VirtualAddressFromPhysical_IO(const u32 address) {
+ return (address + 0x0EB00000);
+}
+
+inline const u32 VirtualAddressFromPhysical_VRAM(const u32 address) {
+ return (address + 0x07000000);
+}
+
} // namespace
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index d0bec31c6..c8daf0df5 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -22,7 +22,7 @@ u32 _AddressPhysicalToVirtual(const u32 addr) {
// to virtual address translations here. This is obviously quite hacky... But we're not doing
// any MMU emulation yet or anything
if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
- return (addr & FCRAM_MASK) | FCRAM_VADDR;
+ return VirtualAddressFromPhysical_FCRAM(addr);
// Hardware IO
// TODO(bunnei): FixMe