diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/loader/nro.cpp | 9 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 10 | ||||
| -rw-r--r-- | src/core/loader/nso.h | 2 |
3 files changed, 2 insertions, 19 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index a5d09512b..66c61b038 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -118,13 +118,6 @@ bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) { | |||
| 118 | } | 118 | } |
| 119 | program_image.resize(PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)); | 119 | program_image.resize(PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)); |
| 120 | 120 | ||
| 121 | // Relocate symbols if there was a proper MOD header - This must happen after the image has been | ||
| 122 | // loaded into memory | ||
| 123 | if (has_mod_header) { | ||
| 124 | Relocate(program_image, nro_header.module_header_offset + mod_header.dynamic_offset, | ||
| 125 | load_base); | ||
| 126 | } | ||
| 127 | |||
| 128 | // Load codeset for current process | 121 | // Load codeset for current process |
| 129 | codeset->name = path; | 122 | codeset->name = path; |
| 130 | codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); | 123 | codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); |
| @@ -154,8 +147,6 @@ ResultStatus AppLoader_NRO::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 154 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); | 147 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); |
| 155 | process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE); | 148 | process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE); |
| 156 | 149 | ||
| 157 | ResolveImports(); | ||
| 158 | |||
| 159 | is_loaded = true; | 150 | is_loaded = true; |
| 160 | return ResultStatus::Success; | 151 | return ResultStatus::Success; |
| 161 | } | 152 | } |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index ff96e129b..ef769dd91 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -88,7 +88,7 @@ static constexpr u32 PageAlignSize(u32 size) { | |||
| 88 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; | 88 | return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base, bool relocate) { | 91 | VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base) { |
| 92 | FileUtil::IOFile file(path, "rb"); | 92 | FileUtil::IOFile file(path, "rb"); |
| 93 | if (!file.IsOpen()) { | 93 | if (!file.IsOpen()) { |
| 94 | return {}; | 94 | return {}; |
| @@ -135,12 +135,6 @@ VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base, bool relo | |||
| 135 | const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)}; | 135 | const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)}; |
| 136 | program_image.resize(image_size); | 136 | program_image.resize(image_size); |
| 137 | 137 | ||
| 138 | // Relocate symbols if there was a proper MOD header - This must happen after the image has been | ||
| 139 | // loaded into memory | ||
| 140 | if (has_mod_header && relocate) { | ||
| 141 | Relocate(program_image, module_offset + mod_header.dynamic_offset, load_base); | ||
| 142 | } | ||
| 143 | |||
| 144 | // Load codeset for current process | 138 | // Load codeset for current process |
| 145 | codeset->name = path; | 139 | codeset->name = path; |
| 146 | codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); | 140 | codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); |
| @@ -181,8 +175,6 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 181 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); | 175 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); |
| 182 | process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE); | 176 | process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE); |
| 183 | 177 | ||
| 184 | ResolveImports(); | ||
| 185 | |||
| 186 | is_loaded = true; | 178 | is_loaded = true; |
| 187 | return ResultStatus::Success; | 179 | return ResultStatus::Success; |
| 188 | } | 180 | } |
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 03424e70d..a24bcdc24 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h | |||
| @@ -34,7 +34,7 @@ public: | |||
| 34 | ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override; | 34 | ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override; |
| 35 | 35 | ||
| 36 | private: | 36 | private: |
| 37 | VAddr LoadNso(const std::string& path, VAddr load_base, bool relocate = false); | 37 | VAddr LoadNso(const std::string& path, VAddr load_base); |
| 38 | 38 | ||
| 39 | std::string filepath; | 39 | std::string filepath; |
| 40 | }; | 40 | }; |