mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-12 18:17:48 +00:00
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.
This commit is contained in:
parent
67744e08c9
commit
e49ee38660
20 changed files with 144 additions and 107 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue