summaryrefslogtreecommitdiff
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.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index c8daf0df5..c057a8114 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -16,14 +16,18 @@ std::map<u32, MemoryBlock> g_heap_map;
16std::map<u32, MemoryBlock> g_heap_gsp_map; 16std::map<u32, MemoryBlock> g_heap_gsp_map;
17std::map<u32, MemoryBlock> g_shared_map; 17std::map<u32, MemoryBlock> g_shared_map;
18 18
19/// Convert a physical address to virtual address 19/// Convert a physical address (or firmware-specific virtual address) to primary virtual address
20u32 _AddressPhysicalToVirtual(const u32 addr) { 20u32 _VirtualAddress(const u32 addr) {
21 // Our memory interface read/write functions assume virtual addresses. Put any physical address 21 // Our memory interface read/write functions assume virtual addresses. Put any physical address
22 // to virtual address translations here. This is obviously quite hacky... But we're not doing 22 // to virtual address translations here. This is obviously quite hacky... But we're not doing
23 // any MMU emulation yet or anything 23 // any MMU emulation yet or anything
24 if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) { 24 if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) {
25 return VirtualAddressFromPhysical_FCRAM(addr); 25 return VirtualAddressFromPhysical_FCRAM(addr);
26 26
27 // Virtual address mapping FW0B
28 } else if ((addr >= FRAM_VADDR_FW0B) && (addr < FRAM_VADDR_FW0B_END)) {
29 return VirtualAddressFromPhysical_FCRAM(addr);
30
27 // Hardware IO 31 // Hardware IO
28 // TODO(bunnei): FixMe 32 // TODO(bunnei): FixMe
29 // This isn't going to work... The physical address of HARDWARE_IO conflicts with the virtual 33 // This isn't going to work... The physical address of HARDWARE_IO conflicts with the virtual
@@ -41,7 +45,7 @@ inline void _Read(T &var, const u32 addr) {
41 // TODO: Make sure this represents the mirrors in a correct way. 45 // TODO: Make sure this represents the mirrors in a correct way.
42 // Could just do a base-relative read, too.... TODO 46 // Could just do a base-relative read, too.... TODO
43 47
44 const u32 vaddr = _AddressPhysicalToVirtual(addr); 48 const u32 vaddr = _VirtualAddress(addr);
45 49
46 // Memory allocated for HLE use that can be addressed from the emulated application 50 // Memory allocated for HLE use that can be addressed from the emulated application
47 // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE 51 // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
@@ -77,7 +81,7 @@ inline void _Read(T &var, const u32 addr) {
77 81
78template <typename T> 82template <typename T>
79inline void _Write(u32 addr, const T data) { 83inline void _Write(u32 addr, const T data) {
80 u32 vaddr = _AddressPhysicalToVirtual(addr); 84 u32 vaddr = _VirtualAddress(addr);
81 85
82 // Memory allocated for HLE use that can be addressed from the emulated application 86 // Memory allocated for HLE use that can be addressed from the emulated application
83 // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE 87 // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
@@ -121,7 +125,7 @@ inline void _Write(u32 addr, const T data) {
121} 125}
122 126
123u8 *GetPointer(const u32 addr) { 127u8 *GetPointer(const u32 addr) {
124 const u32 vaddr = _AddressPhysicalToVirtual(addr); 128 const u32 vaddr = _VirtualAddress(addr);
125 129
126 // FCRAM - GSP heap 130 // FCRAM - GSP heap
127 if ((vaddr >= HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) { 131 if ((vaddr >= HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) {