mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
Remove relocation on NSO/NRO
This commit is contained in:
parent
c7452bab90
commit
c65ac49238
3 changed files with 2 additions and 19 deletions
|
@ -118,13 +118,6 @@ bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) {
|
||||||
}
|
}
|
||||||
program_image.resize(PageAlignSize(static_cast<u32>(program_image.size()) + bss_size));
|
program_image.resize(PageAlignSize(static_cast<u32>(program_image.size()) + bss_size));
|
||||||
|
|
||||||
// Relocate symbols if there was a proper MOD header - This must happen after the image has been
|
|
||||||
// loaded into memory
|
|
||||||
if (has_mod_header) {
|
|
||||||
Relocate(program_image, nro_header.module_header_offset + mod_header.dynamic_offset,
|
|
||||||
load_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load codeset for current process
|
// Load codeset for current process
|
||||||
codeset->name = path;
|
codeset->name = path;
|
||||||
codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
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) {
|
||||||
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
||||||
process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE);
|
process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
ResolveImports();
|
|
||||||
|
|
||||||
is_loaded = true;
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ static constexpr u32 PageAlignSize(u32 size) {
|
||||||
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
|
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base, bool relocate) {
|
VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base) {
|
||||||
FileUtil::IOFile file(path, "rb");
|
FileUtil::IOFile file(path, "rb");
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
return {};
|
return {};
|
||||||
|
@ -135,12 +135,6 @@ VAddr AppLoader_NSO::LoadNso(const std::string& path, VAddr load_base, bool relo
|
||||||
const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)};
|
const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)};
|
||||||
program_image.resize(image_size);
|
program_image.resize(image_size);
|
||||||
|
|
||||||
// Relocate symbols if there was a proper MOD header - This must happen after the image has been
|
|
||||||
// loaded into memory
|
|
||||||
if (has_mod_header && relocate) {
|
|
||||||
Relocate(program_image, module_offset + mod_header.dynamic_offset, load_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load codeset for current process
|
// Load codeset for current process
|
||||||
codeset->name = path;
|
codeset->name = path;
|
||||||
codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
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) {
|
||||||
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
||||||
process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE);
|
process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
ResolveImports();
|
|
||||||
|
|
||||||
is_loaded = true;
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VAddr LoadNso(const std::string& path, VAddr load_base, bool relocate = false);
|
VAddr LoadNso(const std::string& path, VAddr load_base);
|
||||||
|
|
||||||
std::string filepath;
|
std::string filepath;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue