summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-03 04:24:43 +0100
committerLioncash <mathew1800@gmail.com>2018-12-03 05:39:03 +0100
commit7695febfa1f3ef45fbac5fe674c1371c88f483b6 (patch)
tree7e92abf7033e72996c8025cabf633b2d47b14229 /src/core/loader
parentloader/nro: Make the static LoadNro function internally linked (diff)
downloadyuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.tar
yuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.tar.gz
yuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.tar.bz2
yuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.tar.lz
yuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.tar.xz
yuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.tar.zst
yuzu-7695febfa1f3ef45fbac5fe674c1371c88f483b6.zip
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp3
-rw-r--r--src/core/loader/nso.cpp8
-rw-r--r--src/core/loader/nso.h8
3 files changed, 11 insertions, 8 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 8518dddcb..ac04d72d7 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -7,7 +7,6 @@
#include "common/common_funcs.h"
#include "common/file_util.h"
#include "common/logging/log.h"
-#include "core/core.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/patch_manager.h"
@@ -146,7 +145,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(Kernel::Process& process)
const VAddr load_addr = next_load_addr;
const bool should_pass_arguments = std::strcmp(module, "rtld") == 0;
const auto tentative_next_load_addr =
- AppLoader_NSO::LoadModule(*module_file, load_addr, should_pass_arguments, pm);
+ AppLoader_NSO::LoadModule(process, *module_file, load_addr, should_pass_arguments, pm);
if (!tentative_next_load_addr) {
return ResultStatus::ErrorLoadingNSO;
}
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index aaf006309..6ded0b707 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -9,7 +9,6 @@
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/swap.h"
-#include "core/core.h"
#include "core/file_sys/patch_manager.h"
#include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/process.h"
@@ -93,7 +92,8 @@ static constexpr u32 PageAlignSize(u32 size) {
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
}
-std::optional<VAddr> AppLoader_NSO::LoadModule(const FileSys::VfsFile& file, VAddr load_base,
+std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process,
+ const FileSys::VfsFile& file, VAddr load_base,
bool should_pass_arguments,
std::optional<FileSys::PatchManager> pm) {
if (file.GetSize() < sizeof(NsoHeader))
@@ -166,7 +166,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(const FileSys::VfsFile& file, VAd
// Load codeset for current process
codeset.memory = std::make_shared<std::vector<u8>>(std::move(program_image));
- Core::CurrentProcess()->LoadModule(std::move(codeset), load_base);
+ process.LoadModule(std::move(codeset), load_base);
// Register module with GDBStub
GDBStub::RegisterModule(file.GetName(), load_base, load_base);
@@ -181,7 +181,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::Process& process) {
// Load module
const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress();
- if (!LoadModule(*file, base_address, true)) {
+ if (!LoadModule(process, *file, base_address, true)) {
return ResultStatus::ErrorLoadingNSO;
}
LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", file->GetName(), base_address);
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h
index 433306139..0c1defbb6 100644
--- a/src/core/loader/nso.h
+++ b/src/core/loader/nso.h
@@ -10,6 +10,10 @@
#include "core/loader/linker.h"
#include "core/loader/loader.h"
+namespace Kernel {
+class Process;
+}
+
namespace Loader {
constexpr u64 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000;
@@ -37,8 +41,8 @@ public:
return IdentifyType(file);
}
- static std::optional<VAddr> LoadModule(const FileSys::VfsFile& file, VAddr load_base,
- bool should_pass_arguments,
+ static std::optional<VAddr> LoadModule(Kernel::Process& process, const FileSys::VfsFile& file,
+ VAddr load_base, bool should_pass_arguments,
std::optional<FileSys::PatchManager> pm = {});
ResultStatus Load(Kernel::Process& process) override;