From 2068658a82eb7fff72db040fd141357bc788dd1e Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Thu, 27 Feb 2020 13:01:39 -0400 Subject: [PATCH] A64 Interface: Allow changing processor id. This commit allows the JIT to be used per guest thread and change it's core when the thread is migrated. --- include/dynarmic/A64/a64.h | 2 ++ src/backend/x64/a64_emit_x64.h | 6 +++++- src/backend/x64/a64_interface.cpp | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/dynarmic/A64/a64.h b/include/dynarmic/A64/a64.h index f51f6fad..5a84e4e0 100644 --- a/include/dynarmic/A64/a64.h +++ b/include/dynarmic/A64/a64.h @@ -105,6 +105,8 @@ public: /// Modify PSTATE void SetPstate(std::uint32_t value); + void ChangeProcessorID(std::size_t new_processor); + /// Clears exclusive state for this core. void ClearExclusiveState(); diff --git a/src/backend/x64/a64_emit_x64.h b/src/backend/x64/a64_emit_x64.h index c8fd2566..71dbbf2f 100644 --- a/src/backend/x64/a64_emit_x64.h +++ b/src/backend/x64/a64_emit_x64.h @@ -47,8 +47,12 @@ public: void InvalidateCacheRanges(const boost::icl::interval_set& ranges); + void ChangeProcessorID(size_t value) { + conf.processor_id = value; + } + protected: - const A64::UserConfig conf; + A64::UserConfig conf; A64::Jit* jit_interface; BlockRangeInformation block_ranges; diff --git a/src/backend/x64/a64_interface.cpp b/src/backend/x64/a64_interface.cpp index ee1763a4..2986fcbe 100644 --- a/src/backend/x64/a64_interface.cpp +++ b/src/backend/x64/a64_interface.cpp @@ -185,6 +185,11 @@ public: jit_state.SetPstate(value); } + void ChangeProcessorID(size_t value) { + conf.processor_id = value; + emitter.ChangeProcessorID(value); + } + void ClearExclusiveState() { jit_state.exclusive_state = 0; } @@ -379,6 +384,10 @@ void Jit::SetPstate(u32 value) { impl->SetPstate(value); } +void Jit::ChangeProcessorID(size_t new_processor) { + impl->ChangeProcessorID(new_processor); +} + void Jit::ClearExclusiveState() { impl->ClearExclusiveState(); }