FPU: Properly implement INT 10h FPU exception, fixes #5162.

This commit is contained in:
OBattler
2025-01-19 09:06:39 +01:00
parent 5e12d46f32
commit 40fd79aeb9
10 changed files with 55 additions and 15 deletions

View File

@@ -357,6 +357,8 @@ exec386_dynarec_int(void)
CPU_BLOCK_END();
if (smi_line)
CPU_BLOCK_END();
else if (new_ne)
CPU_BLOCK_END();
else if (trap)
CPU_BLOCK_END();
else if (nmi && nmi_enable && nmi_mask)
@@ -366,7 +368,7 @@ exec386_dynarec_int(void)
}
block_ended:
if (!cpu_state.abrt && trap) {
if (!cpu_state.abrt && !new_ne && trap) {
# ifdef USE_DEBUG_REGS_486
//pclog("Debug trap 0x%X\n", trap);
if (trap & 2) dr[6] |= 0x8000;
@@ -602,6 +604,8 @@ exec386_dynarec_dyn(void)
if (cpu_init)
CPU_BLOCK_END();
if (new_ne)
CPU_BLOCK_END();
if ((cpu_state.flags & T_FLAG) || (trap == 2))
CPU_BLOCK_END();
if (smi_line)
@@ -626,7 +630,7 @@ exec386_dynarec_dyn(void)
cpu_end_block_after_ins = 0;
if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !x86_was_reset)
if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !new_ne && !x86_was_reset)
codegen_block_end_recompile(block);
if (x86_was_reset)
@@ -702,6 +706,8 @@ exec386_dynarec_dyn(void)
if (cpu_init)
CPU_BLOCK_END();
if (new_ne)
CPU_BLOCK_END();
if (cpu_state.flags & T_FLAG)
CPU_BLOCK_END();
if (smi_line)
@@ -726,7 +732,7 @@ exec386_dynarec_dyn(void)
cpu_end_block_after_ins = 0;
if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !x86_was_reset)
if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !new_ne && !x86_was_reset)
codegen_block_end();
if (x86_was_reset)
@@ -809,6 +815,15 @@ exec386_dynarec(int32_t cycs)
}
}
if (new_ne) {
# ifndef USE_NEW_DYNAREC
oldcs = CS;
# endif
cpu_state.oldpc = cpu_state.pc;
new_ne = 0;
x86_int(16);
}
if (smi_line)
enter_smm_check(0);
else if (nmi && nmi_enable && nmi_mask) {
@@ -977,6 +992,15 @@ block_ended:
#endif
}
}
} else if (new_ne) {
flags_rebuild();
new_ne = 0;
#ifndef USE_NEW_DYNAREC
oldcs = CS;
#endif
cpu_state.oldpc = cpu_state.pc;
x86_int(16);
} else if (trap) {
flags_rebuild();
#ifdef USE_DEBUG_REGS_486