diff options
| author | 2019-04-09 17:03:04 -0400 | |
|---|---|---|
| committer | 2019-04-11 22:11:41 -0400 | |
| commit | 612e1388df3bed64081488f2a99cce522c80c76d (patch) | |
| tree | 2d2782d0df46e9458ec2a2728f5cd66f27963ea9 /src/core/loader/elf.cpp | |
| parent | core/process: Remove unideal page table setting from LoadFromMetadata() (diff) | |
| download | yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.gz yuzu-612e1388df3bed64081488f2a99cce522c80c76d.tar.xz yuzu-612e1388df3bed64081488f2a99cce522c80c76d.zip | |
core/core: Move process execution start to System's Load()
This gives us significantly more control over where in the
initialization process we start execution of the main process.
Previously we were running the main process before the CPU or GPU
threads were initialized (not good). This amends execution to start
after all of our threads are properly set up.
Diffstat (limited to 'src/core/loader/elf.cpp')
| -rw-r--r-- | src/core/loader/elf.cpp | 15 |
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) { | |||
| 382 | return FileType::Error; | 382 | return FileType::Error; |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | ResultStatus AppLoader_ELF::Load(Kernel::Process& process) { | 385 | AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::Process& process) { |
| 386 | if (is_loaded) | 386 | if (is_loaded) { |
| 387 | return ResultStatus::ErrorAlreadyLoaded; | 387 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 388 | } | ||
| 388 | 389 | ||
| 389 | std::vector<u8> buffer = file->ReadAllBytes(); | 390 | std::vector<u8> buffer = file->ReadAllBytes(); |
| 390 | if (buffer.size() != file->GetSize()) | 391 | if (buffer.size() != file->GetSize()) { |
| 391 | return ResultStatus::ErrorIncorrectELFFileSize; | 392 | return {ResultStatus::ErrorIncorrectELFFileSize, {}}; |
| 393 | } | ||
| 392 | 394 | ||
| 393 | const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); | 395 | const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); |
| 394 | ElfReader elf_reader(&buffer[0]); | 396 | ElfReader elf_reader(&buffer[0]); |
| @@ -396,10 +398,9 @@ ResultStatus AppLoader_ELF::Load(Kernel::Process& process) { | |||
| 396 | const VAddr entry_point = codeset.entrypoint; | 398 | const VAddr entry_point = codeset.entrypoint; |
| 397 | 399 | ||
| 398 | process.LoadModule(std::move(codeset), entry_point); | 400 | process.LoadModule(std::move(codeset), entry_point); |
| 399 | process.Run(entry_point, 48, Memory::DEFAULT_STACK_SIZE); | ||
| 400 | 401 | ||
| 401 | is_loaded = true; | 402 | is_loaded = true; |
| 402 | return ResultStatus::Success; | 403 | return {ResultStatus::Success, LoadParameters{48, Memory::DEFAULT_STACK_SIZE}}; |
| 403 | } | 404 | } |
| 404 | 405 | ||
| 405 | } // namespace Loader | 406 | } // namespace Loader |