summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nro.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/loader/nro.cpp')
-rw-r--r--src/core/loader/nro.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp
index ed638e1fa..753e7e08b 100644
--- a/src/core/loader/nro.cpp
+++ b/src/core/loader/nro.cpp
@@ -75,17 +75,6 @@ static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NroSegmentHeade
return data;
}
-VAddr AppLoader_NRO::GetEntryPoint(VAddr load_base) const {
- // Find nnMain function, set entrypoint to that address
- const auto& search = exports.find("nnMain");
- if (search != exports.end()) {
- return load_base + search->second;
- }
- const VAddr entry_point{load_base + sizeof(NroHeader)};
- LOG_ERROR(Loader, "Unable to find entrypoint, defaulting to: 0x%llx", entry_point);
- return entry_point;
-}
-
bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) {
FileUtil::IOFile file(path, "rb");
if (!file.IsOpen()) {
@@ -152,9 +141,9 @@ ResultStatus AppLoader_NRO::Load() {
}
// Load and relocate "main" and "sdk" NSO
- static constexpr VAddr main_base{0x10000000};
+ static constexpr VAddr base_addr{Memory::PROCESS_IMAGE_VADDR};
Kernel::g_current_process = Kernel::Process::Create("main");
- if (!LoadNro(filepath, main_base)) {
+ if (!LoadNro(filepath, base_addr)) {
return ResultStatus::ErrorInvalidFormat;
}
@@ -162,7 +151,7 @@ ResultStatus AppLoader_NRO::Load() {
Kernel::g_current_process->address_mappings = default_address_mappings;
Kernel::g_current_process->resource_limit =
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
- Kernel::g_current_process->Run(GetEntryPoint(main_base), 48, Kernel::DEFAULT_STACK_SIZE);
+ Kernel::g_current_process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE);
ResolveImports();