diff options
| author | 2014-04-27 22:32:51 -0400 | |
|---|---|---|
| committer | 2014-04-27 22:32:51 -0400 | |
| commit | af921daa4c4bb9c02b53dfcaa35e3f4158b6bf21 (patch) | |
| tree | cd08857a31878aa55d97d1d2e3a36f8bbfe942ec /src/core/mem_map_funcs.cpp | |
| parent | fix for issue Linux build #9, not sure why this is broken but its unused code... (diff) | |
| download | yuzu-af921daa4c4bb9c02b53dfcaa35e3f4158b6bf21.tar.gz yuzu-af921daa4c4bb9c02b53dfcaa35e3f4158b6bf21.tar.xz yuzu-af921daa4c4bb9c02b53dfcaa35e3f4158b6bf21.zip | |
added virtual address conversion for firmware FW0B
Diffstat (limited to 'src/core/mem_map_funcs.cpp')
| -rw-r--r-- | src/core/mem_map_funcs.cpp | 14 |
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; | |||
| 16 | std::map<u32, MemoryBlock> g_heap_gsp_map; | 16 | std::map<u32, MemoryBlock> g_heap_gsp_map; |
| 17 | std::map<u32, MemoryBlock> g_shared_map; | 17 | std::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 |
| 20 | u32 _AddressPhysicalToVirtual(const u32 addr) { | 20 | u32 _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 | ||
| 78 | template <typename T> | 82 | template <typename T> |
| 79 | inline void _Write(u32 addr, const T data) { | 83 | inline 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 | ||
| 123 | u8 *GetPointer(const u32 addr) { | 127 | u8 *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)) { |