Fixes the behavior of F(N)INIT and F(N)SAVE on 8087, fixes the only MCPDIAG failure that was actually an 86Box bug, closes #4518.

This commit is contained in:
OBattler
2024-07-29 04:34:47 +02:00
parent 4d3b062793
commit cb275dd6a3
2 changed files with 14 additions and 4 deletions

View File

@@ -78,7 +78,11 @@ opFINIT(uint32_t fetchdat)
cpu_state.npxc = 0x37F;
#endif
codegen_set_rounding_mode(X87_ROUNDING_NEAREST);
#ifdef FPU_8087
cpu_state.npxs &= 0x4700;
#else
cpu_state.npxs = 0;
#endif
p = (uint64_t *) cpu_state.tag;
#ifdef USE_NEW_DYNAREC
*p = 0;
@@ -406,7 +410,11 @@ FSAVE(void)
cpu_state.npxc = 0x37F;
codegen_set_rounding_mode(X87_ROUNDING_NEAREST);
#ifdef FPU_8087
cpu_state.npxs &= 0x4700;
#else
cpu_state.npxs = 0;
#endif
p = (uint64_t *) cpu_state.tag;
#ifdef USE_NEW_DYNAREC
*p = 0;

View File

@@ -431,11 +431,12 @@ sf_FNSAVE_a16(uint32_t fetchdat)
}
#ifdef FPU_8087
fpu_state.swd = 0x3FF;
fpu_state.cwd = 0x3FF;
fpu_state.swd &= 0x4700;
#else
fpu_state.cwd = 0x37F;
#endif
fpu_state.swd = 0;
#endif
fpu_state.tos = 0;
fpu_state.tag = 0xffff;
cpu_state.ismmx = 0;
@@ -467,7 +468,7 @@ sf_FNSAVE_a32(uint32_t fetchdat)
}
# ifdef FPU_8087
fpu_state.swd = 0x3FF;
fpu_state.cwd = 0x3FF;
# else
fpu_state.cwd = 0x37F;
# endif
@@ -504,10 +505,11 @@ sf_FNINIT(uint32_t fetchdat)
cpu_state.pc++;
#ifdef FPU_8087
fpu_state.cwd = 0x3FF;
fpu_state.swd &= 0x4700;
#else
fpu_state.cwd = 0x37F;
#endif
fpu_state.swd = 0;
#endif
fpu_state.tos = 0;
fpu_state.tag = 0xffff;
fpu_state.foo = 0;