nso: Load more common submodules.
This commit is contained in:
parent
9ceb0d9381
commit
3f0caefdf5
1 changed files with 11 additions and 15 deletions
|
@ -153,22 +153,18 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||||
return ResultStatus::Error;
|
return ResultStatus::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load and relocate "rtld" NSO
|
|
||||||
static constexpr VAddr base_addr{Memory::PROCESS_IMAGE_VADDR};
|
|
||||||
process = Kernel::Process::Create("main");
|
process = Kernel::Process::Create("main");
|
||||||
VAddr next_base_addr{LoadNso(filepath, base_addr)};
|
|
||||||
if (!next_base_addr) {
|
|
||||||
return ResultStatus::ErrorInvalidFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load and relocate remaining submodules
|
// Load NSO modules
|
||||||
for (const auto& module_name : {"main", "sdk", "subsdk0", "subsdk1"}) {
|
VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR};
|
||||||
LOG_INFO(Loader, "loading %s @ 0x%llx", module_name, next_base_addr);
|
for (const auto& module : {"rtld", "main", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3"}) {
|
||||||
const std::string module_path =
|
const std::string path = filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module;
|
||||||
filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module_name;
|
const VAddr load_addr = next_load_addr;
|
||||||
next_base_addr = LoadNso(module_path, next_base_addr);
|
next_load_addr = LoadNso(path, load_addr);
|
||||||
if (!next_base_addr) {
|
if (next_load_addr) {
|
||||||
LOG_WARNING(Loader, "failed to find load module: %s", module_name);
|
LOG_DEBUG(Loader, "loaded module %s @ 0x%llx", module, load_addr);
|
||||||
|
} else {
|
||||||
|
next_load_addr = load_addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +172,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||||
process->address_mappings = default_address_mappings;
|
process->address_mappings = default_address_mappings;
|
||||||
process->resource_limit =
|
process->resource_limit =
|
||||||
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
||||||
process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE);
|
process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
ResolveImports();
|
ResolveImports();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue