summaryrefslogtreecommitdiffstats
path: root/src/core/loader/elf.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-09 23:03:04 +0200
committerLioncash <mathew1800@gmail.com>2019-04-12 04:11:41 +0200
commit612e1388df3bed64081488f2a99cce522c80c76d (patch)
tree2d2782d0df46e9458ec2a2728f5cd66f27963ea9 /src/core/loader/elf.cpp
parentcore/process: Remove unideal page table setting from LoadFromMetadata() (diff)
downloadyuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.gz
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.bz2
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.lz
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.xz
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.zst
yuzu-612e1388df3bed64081488f2a99cce522c80c76d.zip
Diffstat (limited to 'src/core/loader/elf.cpp')
-rw-r--r--src/core/loader/elf.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 46ac372f6..6d4b02375 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -382,13 +382,15 @@ FileType AppLoader_ELF::IdentifyType(const FileSys::VirtualFile& file) {
return FileType::Error;
}
-ResultStatus AppLoader_ELF::Load(Kernel::Process& process) {
- if (is_loaded)
- return ResultStatus::ErrorAlreadyLoaded;
+AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::Process& process) {
+ if (is_loaded) {
+ return {ResultStatus::ErrorAlreadyLoaded, {}};
+ }
std::vector<u8> buffer = file->ReadAllBytes();
- if (buffer.size() != file->GetSize())
- return ResultStatus::ErrorIncorrectELFFileSize;
+ if (buffer.size() != file->GetSize()) {
+ return {ResultStatus::ErrorIncorrectELFFileSize, {}};
+ }
const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress();
ElfReader elf_reader(&buffer[0]);
@@ -396,10 +398,9 @@ ResultStatus AppLoader_ELF::Load(Kernel::Process& process) {
const VAddr entry_point = codeset.entrypoint;
process.LoadModule(std::move(codeset), entry_point);
- process.Run(entry_point, 48, Memory::DEFAULT_STACK_SIZE);
is_loaded = true;
- return ResultStatus::Success;
+ return {ResultStatus::Success, LoadParameters{48, Memory::DEFAULT_STACK_SIZE}};
}
} // namespace Loader