mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 13:00:15 +02:00
Interpreter: Moves around the thread and ELF initialization code
This allows the context and parent thread objects to be created earlier, allowing the VDSO and ELFCodeLoader mapping functions to have a thread object for tracking memory mappings through the regular guest routines. This means that we no longer need to do any form of deferred handling for code caching as all the state is ready early in the initialization process. A little bit of care needed to be taken to ensure we still close the ELFCodeLoader's FDs later and that VDSO unmapping happens before tearing down the parent thread, but overall this is mostly just passing the InternalThreadState object around as normal. I couldn't find any functional regression from this change alongside code caching, but it would be good for @neobrain to double check this.
This commit is contained in:
7 files changed
+103
-113
No files matched your search
@@ -153,19 +153,20 @@ GenerateSingleCache(const FEXCore::ExecutableFileInfo& Binary, fextl::set<uintpt
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (!Is64Bit) {
|
||||
// Block upper address space
|
||||
FEXCore::Allocator::SetupHooks();
|
||||
}
|
||||
|
||||
auto Thread = SetupCompileThread(*CTX, Is64Bit);
|
||||
|
||||
{
|
||||
if (!Is64Bit) {
|
||||
// Block upper address space
|
||||
FEXCore::Allocator::SetupHooks();
|
||||
}
|
||||
auto ElfBase = Loader.LoadMainElfFile(nullptr, SyscallHandler.get());
|
||||
auto ElfBase = Loader.LoadMainElfFile(nullptr, SyscallHandler.get(), Thread);
|
||||
if (!ElfBase.has_value()) {
|
||||
ERROR_AND_DIE_FMT("Failed to load ELF file {} ({})", Binary.Filename, Binary.FileId);
|
||||
}
|
||||
}
|
||||
|
||||
auto Thread = SetupCompileThread(*CTX, Is64Bit);
|
||||
|
||||
CTX->GetCodeCache().InitiateCacheGeneration();
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user