From d7abae1e3122192a99af019ea83788221e3d64b6 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 5 Apr 2020 12:11:36 -0400 Subject: [PATCH] A64: Implement Exceptional Exit. --- include/dynarmic/A64/a64.h | 6 ++++++ src/backend/x64/a64_interface.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/dynarmic/A64/a64.h b/include/dynarmic/A64/a64.h index 5a84e4e0..2e9fe15a 100644 --- a/include/dynarmic/A64/a64.h +++ b/include/dynarmic/A64/a64.h @@ -60,6 +60,12 @@ public: */ void HaltExecution(); + /** + * Exits execution from a callback, the callback must rewind the stack or + * never return to dynarmic from it's current stack. + */ + void ExceptionalExit(); + /// Read Stack Pointer std::uint64_t GetSP() const; /// Modify Stack Pointer diff --git a/src/backend/x64/a64_interface.cpp b/src/backend/x64/a64_interface.cpp index cf58f281..05a76478 100644 --- a/src/backend/x64/a64_interface.cpp +++ b/src/backend/x64/a64_interface.cpp @@ -83,6 +83,15 @@ public: PerformRequestedCacheInvalidation(); } + void ExceptionalExit() { + if (!conf.wall_clock_cntpct) { + const s64 ticks = jit_state.cycles_to_run - jit_state.cycles_remaining; + conf.callbacks->AddTicks(ticks); + } + PerformRequestedCacheInvalidation(); + is_executing = false; + } + void ClearCache() { invalidate_entire_cache = true; RequestCacheInvalidation(); @@ -313,6 +322,10 @@ void Jit::HaltExecution() { impl->HaltExecution(); } +void Jit::ExceptionalExit() { + impl->ExceptionalExit(); +} + u64 Jit::GetSP() const { return impl->GetSP(); }