diff --git a/src/backend_x64/emit_x64.cpp b/src/backend_x64/emit_x64.cpp index ad71baaf..861cde55 100644 --- a/src/backend_x64/emit_x64.cpp +++ b/src/backend_x64/emit_x64.cpp @@ -307,7 +307,11 @@ void EmitX64::EmitCallSupervisor(IR::Block&, IR::Inst* inst) { reg_alloc.HostCall(nullptr, imm32); + code->STMXCSR(MDisp(R15, offsetof(JitState, guest_MXCSR))); + code->LDMXCSR(MDisp(R15, offsetof(JitState, save_host_MXCSR))); code->ABI_CallFunction(reinterpret_cast(cb.CallSVC)); + code->STMXCSR(MDisp(R15, offsetof(JitState, save_host_MXCSR))); + code->LDMXCSR(MDisp(R15, offsetof(JitState, guest_MXCSR))); } void EmitX64::EmitGetCarryFromOp(IR::Block&, IR::Inst*) { diff --git a/src/backend_x64/jitstate.cpp b/src/backend_x64/jitstate.cpp index f7bba4dc..36e90b42 100644 --- a/src/backend_x64/jitstate.cpp +++ b/src/backend_x64/jitstate.cpp @@ -90,7 +90,7 @@ void JitState::SetFpscr(u32 FPSCR) { guest_MXCSR = 0; // Exception masks / enables - guest_MXCSR |= 0b1111110000000; // mask all + guest_MXCSR |= 0x00001f80; // mask all //guest_MXCSR |= (~FPSCR >> 1) & 0b0000010000000; // IM = ~IOE //guest_MXCSR |= (~FPSCR >> 7) & 0b0000100000000; // DM = ~IDE //guest_MXCSR |= (~FPSCR ) & 0b1111000000000; // PM, UM, OM, ZM = ~IXE, ~UFE, ~OFE, ~DZE diff --git a/src/backend_x64/jitstate.h b/src/backend_x64/jitstate.h index 2efb23dd..c4221411 100644 --- a/src/backend_x64/jitstate.h +++ b/src/backend_x64/jitstate.h @@ -25,7 +25,7 @@ struct JitState { std::array Spill{}; // Spill. // For internal use (See: Routines::RunCode) - u32 guest_MXCSR = 0; + u32 guest_MXCSR = 0x00001f80; u32 save_host_MXCSR = 0; u64 save_host_RSP = 0; s64 cycles_remaining = 0;