diff --git a/src/backend/x64/a32_interface.cpp b/src/backend/x64/a32_interface.cpp index 6f4141a4..a4835db5 100644 --- a/src/backend/x64/a32_interface.cpp +++ b/src/backend/x64/a32_interface.cpp @@ -272,13 +272,13 @@ void TransferJitState(A32JitState& dest, const A32JitState& src, bool reset_rsb) } void Jit::SaveContext(Context& ctx) const { - TransferJitState(ctx.impl->jit_state, impl->jit_state, false); + ctx.impl->jit_state.TransferJitState(impl->jit_state, false); ctx.impl->invalid_cache_generation = impl->invalid_cache_generation; } void Jit::LoadContext(const Context& ctx) { bool reset_rsb = ctx.impl->invalid_cache_generation != impl->invalid_cache_generation; - TransferJitState(impl->jit_state, ctx.impl->jit_state, reset_rsb); + impl->jit_state.TransferJitState(ctx.impl->jit_state, reset_rsb); } std::string Jit::Disassemble(const IR::LocationDescriptor& descriptor) { diff --git a/src/backend/x64/a32_jitstate.h b/src/backend/x64/a32_jitstate.h index 24802e56..ad15fbd4 100644 --- a/src/backend/x64/a32_jitstate.h +++ b/src/backend/x64/a32_jitstate.h @@ -76,6 +76,31 @@ struct A32JitState { u64 GetUniqueHash() const noexcept { return (static_cast(upper_location_descriptor) << 32) | (static_cast(Reg[15])); } + + void TransferJitState(const A32JitState& src, bool reset_rsb) { + Reg = src.Reg; + upper_location_descriptor = src.upper_location_descriptor; + cpsr_ge = src.cpsr_ge; + cpsr_q = src.cpsr_q; + cpsr_nzcv = src.cpsr_nzcv; + cpsr_jaifm = src.cpsr_jaifm; + ExtReg = src.ExtReg; + guest_MXCSR = src.guest_MXCSR; + fpsr_exc = src.fpsr_exc; + fpsr_qc = src.fpsr_qc; + fpsr_nzcv = src.fpsr_nzcv; + + exclusive_state = 0; + exclusive_address = 0; + + if (reset_rsb) { + ResetRSB(); + } else { + rsb_ptr = src.rsb_ptr; + rsb_location_descriptors = src.rsb_location_descriptors; + rsb_codeptrs = src.rsb_codeptrs; + } + } }; #ifdef _MSC_VER