From 2179ad7483bde3c210bf4f638ae8801b3ba11214 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Fri, 17 May 2019 21:41:33 -0400 Subject: core: Track load offsets of NSO modules Needed for backtrace decomposition --- src/core/loader/nso.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/loader/nso.cpp') diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 8592b1f44..7beeaaff3 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -164,6 +164,9 @@ std::optional AppLoader_NSO::LoadModule(Kernel::Process& process, // Register module with GDBStub GDBStub::RegisterModule(file.GetName(), load_base, load_base); + // Register module for ARMInterface with System + Core::System::GetInstance().RegisterNSOModule(file.GetName(), load_base); + return load_base + image_size; } -- cgit v1.2.3 From b77fde7c5c1f63aad9d4f01ea625805661870f3e Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 26 May 2019 11:40:41 -0400 Subject: loader: Move NSO module tracking to AppLoader Also cleanup of general stuff --- src/core/loader/nso.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/core/loader/nso.cpp') diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 7beeaaff3..e0d6ab473 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -164,9 +164,6 @@ std::optional AppLoader_NSO::LoadModule(Kernel::Process& process, // Register module with GDBStub GDBStub::RegisterModule(file.GetName(), load_base, load_base); - // Register module for ARMInterface with System - Core::System::GetInstance().RegisterNSOModule(file.GetName(), load_base); - return load_base + image_size; } @@ -175,11 +172,15 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process) { return {ResultStatus::ErrorAlreadyLoaded, {}}; } + modules.clear(); + // Load module const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); if (!LoadModule(process, *file, base_address, true)) { return {ResultStatus::ErrorLoadingNSO, {}}; } + + modules.insert_or_assign(base_address, file->GetName()); LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", file->GetName(), base_address); is_loaded = true; @@ -187,4 +188,9 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process) { LoadParameters{Kernel::THREADPRIO_DEFAULT, Memory::DEFAULT_STACK_SIZE}}; } +ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) { + modules = this->modules; + return ResultStatus::Success; +} + } // namespace Loader -- cgit v1.2.3