mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-07 08:00:21 +02:00
Now that all the threading behaviour has been correctly separated/moved
to the frontend, these functions serve no purpose.
- Instead of using RunUntilExit, all threads can use `ExecuteThread`
directly, since there's nothing special about the primary thread now.
- This also removes the public function definition of `ExecutionThread` since that was only used for threading logic.
- Instead of using an exit handler, just do the same cleanup after
`ExecuteThread` has returned.
- Just make gdbserver is cleaned up early if it exists since it may
want to send some things to the connected gdb instance before
threads are exited.
64 lines
2.3 KiB
C++
64 lines
2.3 KiB
C++
// SPDX-License-Identifier: MIT
|
|
#include "Interface/Context/Context.h"
|
|
#include "Interface/Core/OpcodeDispatcher.h"
|
|
#include "Interface/Core/X86Tables/X86Tables.h"
|
|
|
|
#include <FEXCore/Core/CoreState.h>
|
|
#include <FEXCore/Core/Context.h>
|
|
#include <FEXCore/Core/CPUID.h>
|
|
#include <FEXCore/Core/HostFeatures.h>
|
|
#include <FEXCore/Core/SignalDelegator.h>
|
|
#include <FEXCore/Core/Thunks.h>
|
|
#include "FEXCore/Debug/InternalThreadState.h"
|
|
|
|
#include <string.h>
|
|
#include <utility>
|
|
|
|
namespace FEXCore::Context {
|
|
void InitializeStaticTables(OperatingMode Mode) {
|
|
X86Tables::InitializeInfoTables(Mode);
|
|
IR::InstallOpcodeHandlers(Mode);
|
|
}
|
|
|
|
fextl::unique_ptr<FEXCore::Context::Context> FEXCore::Context::Context::CreateNewContext(const FEXCore::HostFeatures& Features) {
|
|
return fextl::make_unique<FEXCore::Context::ContextImpl>(Features);
|
|
}
|
|
|
|
void FEXCore::Context::ContextImpl::CompileRIP(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestRIP) {
|
|
CompileBlock(Thread->CurrentFrame, GuestRIP);
|
|
}
|
|
|
|
void FEXCore::Context::ContextImpl::CompileRIPCount(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestRIP, uint64_t MaxInst) {
|
|
CompileBlock(Thread->CurrentFrame, GuestRIP, MaxInst);
|
|
}
|
|
|
|
void FEXCore::Context::ContextImpl::SetSignalDelegator(FEXCore::SignalDelegator* _SignalDelegation) {
|
|
SignalDelegation = _SignalDelegation;
|
|
}
|
|
|
|
void FEXCore::Context::ContextImpl::SetSyscallHandler(FEXCore::HLE::SyscallHandler* Handler) {
|
|
SyscallHandler = Handler;
|
|
SourcecodeResolver = Handler->GetSourcecodeResolver();
|
|
}
|
|
|
|
void FEXCore::Context::ContextImpl::SetThunkHandler(FEXCore::ThunkHandler* Handler) {
|
|
ThunkHandler = Handler;
|
|
}
|
|
|
|
FEXCore::CPUID::FunctionResults FEXCore::Context::ContextImpl::RunCPUIDFunction(uint32_t Function, uint32_t Leaf) {
|
|
return CPUID.RunFunction(Function, Leaf);
|
|
}
|
|
|
|
FEXCore::CPUID::XCRResults FEXCore::Context::ContextImpl::RunXCRFunction(uint32_t Function) {
|
|
return CPUID.RunXCRFunction(Function);
|
|
}
|
|
|
|
FEXCore::CPUID::FunctionResults FEXCore::Context::ContextImpl::RunCPUIDFunctionName(uint32_t Function, uint32_t Leaf, uint32_t CPU) {
|
|
return CPUID.RunFunctionName(Function, Leaf, CPU);
|
|
}
|
|
|
|
bool FEXCore::Context::ContextImpl::IsAddressInCodeBuffer(FEXCore::Core::InternalThreadState* Thread, uintptr_t Address) const {
|
|
return Thread->CPUBackend->IsAddressInCodeBuffer(Address);
|
|
}
|
|
} // namespace FEXCore::Context
|