mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-09 14:00:20 +02:00
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.
39 lines
977 B
C++
39 lines
977 B
C++
// SPDX-License-Identifier: MIT
|
|
#pragma once
|
|
|
|
#include <FEXCore/IR/IR.h>
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <span>
|
|
|
|
namespace FEXCore::Core {
|
|
struct InternalThreadState;
|
|
}
|
|
|
|
namespace FEX::HLE {
|
|
class SyscallHandler;
|
|
}
|
|
|
|
namespace FEX::VDSO {
|
|
struct VDSOMapping {
|
|
void* VDSOBase {};
|
|
size_t VDSOSize {};
|
|
void* X86GeneratedCodePtr {};
|
|
size_t X86GeneratedCodeSize {};
|
|
};
|
|
|
|
struct VDSOEntrypoints {
|
|
void* VDSO_kernel_sigreturn;
|
|
void* VDSO_kernel_rt_sigreturn;
|
|
void* VDSO_FEX_CallbackRET;
|
|
};
|
|
VDSOMapping LoadVDSOThunks(FEXCore::Core::InternalThreadState* Thread, bool Is64Bit, FEX::HLE::SyscallHandler* const Handler);
|
|
void UnloadVDSOMapping(FEXCore::Core::InternalThreadState* Thread, FEX::HLE::SyscallHandler* const Handler, const VDSOMapping& Mapping);
|
|
|
|
uint64_t GetVSyscallEntry(const void* VDSOBase);
|
|
|
|
const std::span<FEXCore::IR::ThunkDefinition> GetVDSOThunkDefinitions(bool Is64Bit);
|
|
const VDSOEntrypoints& GetVDSOSymbols();
|
|
} // namespace FEX::VDSO
|