diff options
| author | 2015-07-11 20:07:49 -0700 | |
|---|---|---|
| committer | 2015-07-11 20:07:49 -0700 | |
| commit | 4e900d56f3dd2b5c9871b523689322028123d891 (patch) | |
| tree | 2b233263cff7c001506f660373e2364c8e702637 /src/core/mem_map.cpp | |
| parent | Merge pull request #914 from yuriks/bitfield-mask (diff) | |
| parent | Core: Properly configure address space when loading a binary (diff) | |
| download | yuzu-4e900d56f3dd2b5c9871b523689322028123d891.tar.gz yuzu-4e900d56f3dd2b5c9871b523689322028123d891.tar.xz yuzu-4e900d56f3dd2b5c9871b523689322028123d891.zip | |
Merge pull request #912 from yuriks/process-loading
Core: Properly configure address space during binary loading
Diffstat (limited to 'src/core/mem_map.cpp')
| -rw-r--r-- | src/core/mem_map.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp index d8cae50dd..cbe993fbe 100644 --- a/src/core/mem_map.cpp +++ b/src/core/mem_map.cpp | |||
| @@ -32,7 +32,6 @@ struct MemoryArea { | |||
| 32 | 32 | ||
| 33 | // We don't declare the IO regions in here since its handled by other means. | 33 | // We don't declare the IO regions in here since its handled by other means. |
| 34 | static MemoryArea memory_areas[] = { | 34 | static MemoryArea memory_areas[] = { |
| 35 | {PROCESS_IMAGE_VADDR, PROCESS_IMAGE_MAX_SIZE, "Process Image"}, // ExeFS:/.code is loaded here | ||
| 36 | {HEAP_VADDR, HEAP_SIZE, "Heap"}, // Application heap (main memory) | 35 | {HEAP_VADDR, HEAP_SIZE, "Heap"}, // Application heap (main memory) |
| 37 | {SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, "Shared Memory"}, // Shared memory | 36 | {SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, "Shared Memory"}, // Shared memory |
| 38 | {LINEAR_HEAP_VADDR, LINEAR_HEAP_SIZE, "Linear Heap"}, // Linear heap (main memory) | 37 | {LINEAR_HEAP_VADDR, LINEAR_HEAP_SIZE, "Linear Heap"}, // Linear heap (main memory) |
| @@ -132,13 +131,13 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) { | |||
| 132 | return addr | 0x80000000; | 131 | return addr | 0x80000000; |
| 133 | } | 132 | } |
| 134 | 133 | ||
| 135 | // TODO(yuriks): Move this into Process | ||
| 136 | static Kernel::VMManager address_space; | ||
| 137 | |||
| 138 | void Init() { | 134 | void Init() { |
| 139 | using namespace Kernel; | ||
| 140 | |||
| 141 | InitMemoryMap(); | 135 | InitMemoryMap(); |
| 136 | LOG_DEBUG(HW_Memory, "initialized OK"); | ||
| 137 | } | ||
| 138 | |||
| 139 | void InitLegacyAddressSpace(Kernel::VMManager& address_space) { | ||
| 140 | using namespace Kernel; | ||
| 142 | 141 | ||
| 143 | for (MemoryArea& area : memory_areas) { | 142 | for (MemoryArea& area : memory_areas) { |
| 144 | auto block = std::make_shared<std::vector<u8>>(area.size); | 143 | auto block = std::make_shared<std::vector<u8>>(area.size); |
| @@ -152,14 +151,11 @@ void Init() { | |||
| 152 | auto shared_page_vma = address_space.MapBackingMemory(SHARED_PAGE_VADDR, | 151 | auto shared_page_vma = address_space.MapBackingMemory(SHARED_PAGE_VADDR, |
| 153 | (u8*)&SharedPage::shared_page, SHARED_PAGE_SIZE, MemoryState::Shared).MoveFrom(); | 152 | (u8*)&SharedPage::shared_page, SHARED_PAGE_SIZE, MemoryState::Shared).MoveFrom(); |
| 154 | address_space.Reprotect(shared_page_vma, VMAPermission::Read); | 153 | address_space.Reprotect(shared_page_vma, VMAPermission::Read); |
| 155 | |||
| 156 | LOG_DEBUG(HW_Memory, "initialized OK"); | ||
| 157 | } | 154 | } |
| 158 | 155 | ||
| 159 | void Shutdown() { | 156 | void Shutdown() { |
| 160 | heap_map.clear(); | 157 | heap_map.clear(); |
| 161 | heap_linear_map.clear(); | 158 | heap_linear_map.clear(); |
| 162 | address_space.Reset(); | ||
| 163 | 159 | ||
| 164 | LOG_DEBUG(HW_Memory, "shutdown OK"); | 160 | LOG_DEBUG(HW_Memory, "shutdown OK"); |
| 165 | } | 161 | } |