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/core.cpp | 10 ++++++++++ src/core/core.h | 5 +++++ src/core/loader/nso.cpp | 3 +++ 3 files changed, 18 insertions(+) diff --git a/src/core/core.cpp b/src/core/core.cpp index 7106151bd..96ba6a569 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -270,6 +270,8 @@ struct System::Impl { /// Telemetry session for this emulation session std::unique_ptr telemetry_session; + std::map> modules; + ResultStatus status = ResultStatus::Success; std::string status_details = ""; @@ -509,6 +511,14 @@ void System::ClearContentProvider(FileSys::ContentProviderUnionSlot slot) { impl->content_provider->ClearSlot(slot); } +void System::RegisterNSOModule(std::string name, VAddr start_address) { + impl->modules.insert_or_assign(start_address, name); +} + +const std::map>& System::GetRegisteredNSOModules() const { + return impl->modules; +} + System::ResultStatus System::Init(Frontend::EmuWindow& emu_window) { return impl->Init(*this, emu_window); } diff --git a/src/core/core.h b/src/core/core.h index a9a756a4c..10542ba21 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -8,6 +8,7 @@ #include #include +#include #include "common/common_types.h" #include "core/file_sys/vfs_types.h" #include "core/hle/kernel/object.h" @@ -285,6 +286,10 @@ public: void ClearContentProvider(FileSys::ContentProviderUnionSlot slot); + void RegisterNSOModule(std::string name, VAddr start_address); + + const std::map>& GetRegisteredNSOModules() const; + private: System(); 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