Skip to content

Commit

Permalink
Merge pull request #3286 from Sonicadvance1/remove_getcpustate
Browse files Browse the repository at this point in the history
FEXCore: Removes Get/SetCPUState
  • Loading branch information
Sonicadvance1 committed Nov 29, 2023
2 parents 85a1c1f + e555a8f commit 7de66ac
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 35 deletions.
8 changes: 0 additions & 8 deletions FEXCore/Source/Interface/Context/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ namespace FEXCore::Context {
return IsPaused();
}

void FEXCore::Context::ContextImpl::GetCPUState(FEXCore::Core::CPUState *State) const {
memcpy(State, ParentThread->CurrentFrame, sizeof(FEXCore::Core::CPUState));
}

void FEXCore::Context::ContextImpl::SetCPUState(const FEXCore::Core::CPUState *State) {
memcpy(ParentThread->CurrentFrame, State, sizeof(FEXCore::Core::CPUState));
}

void FEXCore::Context::ContextImpl::SetCustomCPUBackendFactory(CustomCPUFactoryType Factory) {
CustomCPUFactory = std::move(Factory);
}
Expand Down
3 changes: 0 additions & 3 deletions FEXCore/Source/Interface/Context/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ namespace FEXCore::Context {

bool IsDone() const override;

void GetCPUState(FEXCore::Core::CPUState *State) const override;
void SetCPUState(const FEXCore::Core::CPUState *State) override;

void SetCustomCPUBackendFactory(CustomCPUFactoryType Factory) override;

HostFeatures GetHostFeatures() const override;
Expand Down
16 changes: 0 additions & 16 deletions FEXCore/include/FEXCore/Core/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,22 +222,6 @@ namespace FEXCore::Context {
*/
FEX_DEFAULT_VISIBILITY virtual bool IsDone() const = 0;

/**
* @brief Gets a copy the CPUState of the parent thread
*
* @param CTX The context that we created
* @param State The state object to populate
*/
FEX_DEFAULT_VISIBILITY virtual void GetCPUState(FEXCore::Core::CPUState *State) const = 0;

/**
* @brief Copies the CPUState provided to the parent thread
*
* @param CTX The context that we created
* @param State The satate object to copy from
*/
FEX_DEFAULT_VISIBILITY virtual void SetCPUState(const FEXCore::Core::CPUState *State) = 0;

/**
* @brief Allows the frontend to pass in a custom CPUBackend creation factory
*
Expand Down
7 changes: 2 additions & 5 deletions Source/Tools/FEXLoader/IRLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int main(int argc, char **argv, char **const envp)

if (Loader.LoadIR(CTX.get()))
{
CTX->InitCore(Loader.DefaultRIP(), Loader.GetStackPointer());
auto ParentThread = CTX->InitCore(Loader.DefaultRIP(), Loader.GetStackPointer());

auto ShutdownReason = FEXCore::Context::ExitReason::EXIT_SHUTDOWN;

Expand Down Expand Up @@ -211,10 +211,7 @@ int main(int argc, char **argv, char **const envp)
LogMan::Msg::DFmt("Reason we left VM: {}", FEXCore::ToUnderlying(ShutdownReason));

// Just re-use compare state. It also checks against the expected values in config.
FEXCore::Core::CPUState State;
CTX->GetCPUState(&State);

const bool Passed = Loader.CompareStates(&State, SupportsAVX);
const bool Passed = Loader.CompareStates(&ParentThread->CurrentFrame->State, SupportsAVX);

LogMan::Msg::IFmt("Passed? {}\n", Passed ? "Yes" : "No");

Expand Down
6 changes: 3 additions & 3 deletions Source/Tools/FEXLoader/TestHarnessRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ int main(int argc, char **argv, char **const envp) {
CTX->SetSignalDelegator(SignalDelegation.get());
CTX->SetSyscallHandler(SyscallHandler.get());

bool Result1 = CTX->InitCore(Loader.DefaultRIP(), Loader.GetStackPointer());
auto ParentThread = CTX->InitCore(Loader.DefaultRIP(), Loader.GetStackPointer());

if (!Result1) {
if (!ParentThread) {
return 1;
}

Expand All @@ -315,7 +315,7 @@ int main(int argc, char **argv, char **const envp) {
}

// Just re-use compare state. It also checks against the expected values in config.
CTX->GetCPUState(&State);
memcpy(&State, &ParentThread->CurrentFrame->State, sizeof(State));

SyscallHandler.reset();
}
Expand Down

0 comments on commit 7de66ac

Please sign in to comment.