aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/deconstructed_rom_directory.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-24 20:01:45 -0400
committerLioncash <mathew1800@gmail.com>2018-09-24 22:16:03 -0400
commit577bde60b5f6cfab20a9b06248c4ec87e2893bab (patch)
treed766a2d2f20d247e8663c1a76d5c41fcf7f643d4 /src/core/loader/deconstructed_rom_directory.cpp
parent7b36b7d08dd5b0570a951ae6e159963ece08a017 (diff)
memory: Dehardcode the use of fixed memory range constants
The locations of these can actually vary depending on the address space layout, so we shouldn't be using these when determining where to map memory or be using them as offsets for calculations. This keeps all the memory ranges flexible and malleable based off of the virtual memory manager instance state.
Diffstat (limited to 'src/core/loader/deconstructed_rom_directory.cpp')
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 44d62ab7f4..7e8035d0fc 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -17,7 +17,6 @@
#include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/deconstructed_rom_directory.h"
#include "core/loader/nso.h"
-#include "core/memory.h"
namespace Loader {
@@ -134,7 +133,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
process->LoadFromMetadata(metadata);
// Load NSO modules
- VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR};
+ const VAddr base_address = process->vm_manager.GetCodeRegionBaseAddress();
+ VAddr next_load_addr = base_address;
for (const auto& module : {"rtld", "main", "subsdk0", "subsdk1", "subsdk2", "subsdk3",
"subsdk4", "subsdk5", "subsdk6", "subsdk7", "sdk"}) {
const FileSys::VirtualFile module_file = dir->GetFile(module);
@@ -147,8 +147,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
}
}
- process->Run(Memory::PROCESS_IMAGE_VADDR, metadata.GetMainThreadPriority(),
- metadata.GetMainThreadStackSize());
+ process->Run(base_address, metadata.GetMainThreadPriority(), metadata.GetMainThreadStackSize());
// Find the RomFS by searching for a ".romfs" file in this directory
const auto& files = dir->GetFiles();