Fixed a bug (??) in arm_dynarmic where PageTableChanged could reset the CPU context

This commit is contained in:
Hamish Milne 2020-01-17 01:34:03 +00:00 committed by zhupengfei
parent b2370ea353
commit 35c3ca995c

View File

@ -283,15 +283,21 @@ void ARM_Dynarmic::InvalidateCacheRange(u32 start_address, std::size_t length) {
void ARM_Dynarmic::PageTableChanged() {
current_page_table = memory.GetCurrentPageTable();
Dynarmic::A32::Context ctx{};
if (jit) {
jit->SaveContext(ctx);
}
auto iter = jits.find(current_page_table);
if (iter != jits.end()) {
jit = iter->second.get();
jit->LoadContext(ctx);
return;
}
auto new_jit = MakeJit();
jit = new_jit.get();
jit->LoadContext(ctx);
jits.emplace(current_page_table, std::move(new_jit));
}