diff --git a/src/backend_x64/interface_x64.cpp b/src/backend_x64/interface_x64.cpp index 1681d3b3..2edf289c 100644 --- a/src/backend_x64/interface_x64.cpp +++ b/src/backend_x64/interface_x64.cpp @@ -123,6 +123,11 @@ void Jit::ClearCache(bool poison_memory) { impl->emitter.ClearCache(); } +void Jit::Reset() { + ASSERT(!is_executing); + impl->jit_state = {}; +} + void Jit::HaltExecution() { ASSERT(is_executing); halt_requested = true; diff --git a/src/interface/interface.h b/src/interface/interface.h index 9a3bcace..bd592eb7 100644 --- a/src/interface/interface.h +++ b/src/interface/interface.h @@ -57,6 +57,12 @@ public: */ void ClearCache(bool poison_memory = true); + /** + * Reset CPU state to state at startup. Does not clear code cache. + * Cannot be called from a callback. + */ + void Reset(); + /** * Stops execution in Jit::Run. * Can only be called from a callback.