diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-13 04:38:56 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-15 05:04:43 +0200 |
commit | dd4430609afce172542fba1d2cd53c3029f182ce (patch) | |
tree | a04ba64d18dd163709b1cb4b4212afaca6c091a6 /src/core/mem_map.cpp | |
parent | Memory: Read SharedPage directly from Memory::Read (diff) | |
download | yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.tar yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.tar.gz yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.tar.bz2 yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.tar.lz yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.tar.xz yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.tar.zst yuzu-dd4430609afce172542fba1d2cd53c3029f182ce.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/mem_map.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp index 66c2f77c0..5ecec9566 100644 --- a/src/core/mem_map.cpp +++ b/src/core/mem_map.cpp @@ -7,8 +7,11 @@ #include "common/common_types.h" #include "common/logging/log.h" +#include "core/hle/config_mem.h" +#include "core/hle/shared_page.h" #include "core/mem_map.h" #include "core/memory.h" +#include "core/memory_setup.h" //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -26,18 +29,19 @@ namespace { struct MemoryArea { u8** ptr; - size_t size; + u32 base; + u32 size; }; // We don't declare the IO regions in here since its handled by other means. static MemoryArea memory_areas[] = { - {&g_exefs_code, PROCESS_IMAGE_MAX_SIZE}, - {&g_heap, HEAP_SIZE }, - {&g_shared_mem, SHARED_MEMORY_SIZE }, - {&g_heap_linear, LINEAR_HEAP_SIZE }, - {&g_vram, VRAM_SIZE }, - {&g_dsp_mem, DSP_RAM_SIZE }, - {&g_tls_mem, TLS_AREA_SIZE }, + {&g_exefs_code, PROCESS_IMAGE_VADDR, PROCESS_IMAGE_MAX_SIZE}, + {&g_heap, HEAP_VADDR, HEAP_SIZE }, + {&g_shared_mem, SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE }, + {&g_heap_linear, LINEAR_HEAP_VADDR, LINEAR_HEAP_SIZE }, + {&g_vram, VRAM_VADDR, VRAM_SIZE }, + {&g_dsp_mem, DSP_RAM_VADDR, DSP_RAM_SIZE }, + {&g_tls_mem, TLS_AREA_VADDR, TLS_AREA_SIZE }, }; /// Represents a block of memory mapped by ControlMemory/MapMemoryBlock @@ -132,9 +136,14 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) { } void Init() { + InitMemoryMap(); + for (MemoryArea& area : memory_areas) { *area.ptr = new u8[area.size]; + MapMemoryRegion(area.base, area.size, *area.ptr); } + MapMemoryRegion(CONFIG_MEMORY_VADDR, CONFIG_MEMORY_SIZE, (u8*)&ConfigMem::config_mem); + MapMemoryRegion(SHARED_PAGE_VADDR, SHARED_PAGE_SIZE, (u8*)&SharedPage::shared_page); LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p", g_heap); } |