diff options
author | bunnei <ericbunnie@gmail.com> | 2014-04-18 03:15:40 +0200 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-04-18 03:15:40 +0200 |
commit | a9dba388eba586691724187fe53b385cc0bf23aa (patch) | |
tree | cdd718342fba54e3345d111e14150a2461d795a7 | |
parent | more various refactors to memory interface (diff) | |
download | yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.tar yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.tar.gz yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.tar.bz2 yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.tar.lz yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.tar.xz yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.tar.zst yuzu-a9dba388eba586691724187fe53b385cc0bf23aa.zip |
-rw-r--r-- | src/core/mem_map.cpp | 5 | ||||
-rw-r--r-- | src/core/mem_map.h | 4 | ||||
-rw-r--r-- | src/core/mem_map_funcs.cpp | 14 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp index 44b4b07b7..180829239 100644 --- a/src/core/mem_map.cpp +++ b/src/core/mem_map.cpp @@ -16,9 +16,8 @@ u8* g_base = NULL; ///< The base pointer to the aut MemArena g_arena; ///< The MemArena class -u8* g_bootrom = NULL; ///< Bootrom physical memory -u8* g_heap_gsp = NULL; -u8* g_heap = NULL; +u8* g_heap_gsp = NULL; ///< GSP heap (main memory) +u8* g_heap = NULL; ///< Application heap (main memory) u8* g_vram = NULL; ///< Video memory (VRAM) pointer u8* g_physical_bootrom = NULL; ///< Bootrom physical memory diff --git a/src/core/mem_map.h b/src/core/mem_map.h index a1fa90f3e..9ca05cc4e 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h @@ -34,6 +34,7 @@ enum { VRAM_MASK = 0x007FFFFF, FCRAM_MASK = (FCRAM_SIZE - 1), ///< FCRAM mask SCRATCHPAD_MASK = (SCRATCHPAD_SIZE - 1), ///< Scratchpad memory mask + HEAP_GSP_MASK = (HEAP_GSP_SIZE - 1), HEAP_MASK = (HEAP_SIZE - 1), FCRAM_PADDR = 0x20000000, ///< FCRAM physical address @@ -62,7 +63,8 @@ extern u8 *g_base; // These are guaranteed to point to "low memory" addresses (sub-32-bit). // 64-bit: Pointers to low-mem (sub-0x10000000) mirror // 32-bit: Same as the corresponding physical/virtual pointers. -extern u8* g_heap; ///< Main memory +extern u8* g_heap_gsp; ///< GSP heap (main memory) +extern u8* g_heap; ///< Application heap (main memory) extern u8* g_vram; ///< Video memory (VRAM) void Init(); diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 40d9dab3a..5ab1b6e92 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -40,6 +40,10 @@ inline void _Read(T &var, const u32 addr) { } else if ((vaddr & 0xFF000000) == 0x10000000 || (vaddr & 0xFF000000) == 0x1E000000) { HW::Read<T>(var, vaddr); + // FCRAM - GSP heap + } else if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) { + var = *((const T*)&g_heap_gsp[vaddr & HEAP_GSP_MASK]); + // FCRAM - application heap } else if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) { var = *((const T*)&g_heap[vaddr & HEAP_MASK]); @@ -68,8 +72,8 @@ inline void _Write(u32 addr, const T data) { HW::Write<T>(vaddr, data); // FCRAM - GSP heap - //} else if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_VADDR_GSP_END)) { - // *(T*)&g_heap_gsp[vaddr & FCRAM_MASK] = data; + } else if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) { + *(T*)&g_heap_gsp[vaddr & HEAP_GSP_MASK] = data; // FCRAM - application heap } else if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) { @@ -98,8 +102,12 @@ inline void _Write(u32 addr, const T data) { u8 *GetPointer(const u32 addr) { const u32 vaddr = _AddressPhysicalToVirtual(addr); + // FCRAM - GSP heap + if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) { + return g_heap_gsp + (vaddr & HEAP_GSP_MASK); + // FCRAM - application heap - if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) { + } else if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) { return g_heap + (vaddr & HEAP_MASK); } else { |