FPSCR: Save and restore MSCSR across supervisor call, fix MXCSR exception mask

This commit is contained in:
MerryMage 2016-08-07 00:40:29 +01:00
parent c35f06470f
commit f88b1b4c2e
3 changed files with 6 additions and 2 deletions

View file

@ -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<void*>(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*) {

View file

@ -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

View file

@ -25,7 +25,7 @@ struct JitState {
std::array<u64, SpillCount> 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;