From 2fa1c1d13c47629cf69c3bc14602cf6ec1742c90 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 21 Jun 2020 13:15:13 -0400 Subject: [PATCH] A32: Allow cleaning up exclusive state from the interface. This function is normally required for emulating certain OS mechanisms. --- include/dynarmic/A32/a32.h | 3 +++ src/backend/x64/a32_interface.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/include/dynarmic/A32/a32.h b/include/dynarmic/A32/a32.h index 046cd161..a898966f 100644 --- a/include/dynarmic/A32/a32.h +++ b/include/dynarmic/A32/a32.h @@ -87,6 +87,9 @@ public: void SaveContext(Context&) const; void LoadContext(const Context&); + /// Clears exclusive state for this core. + void ClearExclusiveState(); + /** * Returns true if Jit::Run was called but hasn't returned yet. * i.e.: We're in a callback. diff --git a/src/backend/x64/a32_interface.cpp b/src/backend/x64/a32_interface.cpp index 24eb3612..5548065f 100644 --- a/src/backend/x64/a32_interface.cpp +++ b/src/backend/x64/a32_interface.cpp @@ -102,6 +102,10 @@ struct Jit::Impl { emitter.ChangeProcessorID(value); } + void ClearExclusiveState() { + jit_state.exclusive_state = 0; + } + std::string Disassemble(const IR::LocationDescriptor& descriptor) { auto block = GetBasicBlock(descriptor); std::string result = fmt::format("address: {}\nsize: {} bytes\n", block.entrypoint, block.size); @@ -236,6 +240,10 @@ void Jit::ExceptionalExit() { is_executing = false; } +void Jit::ClearExclusiveState() { + impl->ClearExclusiveState(); +} + void Jit::ChangeProcessorID(size_t new_processor) { impl->ChangeProcessorID(new_processor); }