summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nro.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-10-10 03:39:32 +0200
committerbunnei <bunneidev@gmail.com>2017-10-10 03:39:32 +0200
commit23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6 (patch)
tree168e7793c6d68eb8b195850a056443ea98f430a9 /src/core/loader/nro.cpp
parentloader: Add support for NRO, as well as various fixes and shared linker. (diff)
downloadyuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.tar
yuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.tar.gz
yuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.tar.bz2
yuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.tar.lz
yuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.tar.xz
yuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.tar.zst
yuzu-23ce4f5afc66eb04a7aafc4f89685b8109b8d5c6.zip
Diffstat (limited to '')
-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();