nso: Return an optional address from LoadModule

If a malformed NSO is attempted to be loaded, we shouldn't continue
onwards. We should be reporting an error and bailing out.
This commit is contained in:
Lioncash 2018-10-14 21:41:58 -04:00
parent bb9cf8a127
commit bed872ed38
5 changed files with 29 additions and 16 deletions

View file

@ -4,6 +4,7 @@
#pragma once
#include <optional>
#include "common/common_types.h"
#include "core/file_sys/patch_manager.h"
#include "core/loader/linker.h"
@ -36,9 +37,9 @@ public:
return IdentifyType(file);
}
static VAddr LoadModule(const FileSys::VfsFile& file, VAddr load_base,
bool should_pass_arguments,
boost::optional<FileSys::PatchManager> pm = boost::none);
static std::optional<VAddr> LoadModule(const FileSys::VfsFile& file, VAddr load_base,
bool should_pass_arguments,
std::optional<FileSys::PatchManager> pm = {});
ResultStatus Load(Kernel::Process& process) override;
};