From a35717b245b7acb2383c4d0e03cd88e9c2d8d9ce Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 21 Mar 2021 15:25:25 -0700 Subject: core: arm_dynarmic: Ensure JIT state is saved/restored on page table changes. - We re-create the JIT here without preserving any state. --- src/core/arm/dynarmic/arm_dynarmic_32.cpp | 5 +++++ src/core/arm/dynarmic/arm_dynarmic_64.cpp | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src/core/arm') diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index ec4407b6e..53d78de32 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -306,13 +306,18 @@ void ARM_Dynarmic_32::ClearExclusiveState() { void ARM_Dynarmic_32::PageTableChanged(Common::PageTable& page_table, std::size_t new_address_space_size_in_bits) { + ThreadContext32 ctx{}; + SaveContext(ctx); + auto key = std::make_pair(&page_table, new_address_space_size_in_bits); auto iter = jit_cache.find(key); if (iter != jit_cache.end()) { jit = iter->second; + LoadContext(ctx); return; } jit = MakeJit(page_table, new_address_space_size_in_bits); + LoadContext(ctx); jit_cache.emplace(key, jit); } diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index ae5566ab8..b36b7d918 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -348,13 +348,18 @@ void ARM_Dynarmic_64::ClearExclusiveState() { void ARM_Dynarmic_64::PageTableChanged(Common::PageTable& page_table, std::size_t new_address_space_size_in_bits) { + ThreadContext64 ctx{}; + SaveContext(ctx); + auto key = std::make_pair(&page_table, new_address_space_size_in_bits); auto iter = jit_cache.find(key); if (iter != jit_cache.end()) { jit = iter->second; + LoadContext(ctx); return; } jit = MakeJit(page_table, new_address_space_size_in_bits); + LoadContext(ctx); jit_cache.emplace(key, jit); } -- cgit v1.2.3