diff --git a/src/cpu/386.c b/src/cpu/386.c index 940e01a76..3a3e36d58 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -257,6 +257,9 @@ exec386(int cycs) if (!use32) cpu_state.pc &= 0xffff; #endif + if (cpu_end_block_after_ins) + cpu_end_block_after_ins--; + if (cpu_state.abrt) { flags_rebuild(); tempi = cpu_state.abrt & ABRT_MASK; @@ -329,8 +332,6 @@ exec386(int cycs) } } - cpu_end_block_after_ins = 0; - ins_cycles -= cycles; tsc += ins_cycles; diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 552669434..4a8b3637e 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -349,6 +349,12 @@ exec386_dynarec_int(void) if (((cs + cpu_state.pc) >> 12) != pccache) CPU_BLOCK_END(); + if (cpu_end_block_after_ins) { + cpu_end_block_after_ins--; + if (!cpu_end_block_after_ins) + CPU_BLOCK_END(); + } + if (cpu_state.abrt) CPU_BLOCK_END(); if (smi_line) @@ -357,14 +363,8 @@ exec386_dynarec_int(void) CPU_BLOCK_END(); else if (nmi && nmi_enable && nmi_mask) CPU_BLOCK_END(); - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) + else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins) CPU_BLOCK_END(); - - if (cpu_end_block_after_ins) { - cpu_end_block_after_ins--; - if (!cpu_end_block_after_ins) - CPU_BLOCK_END(); - } } if (trap) { @@ -585,21 +585,21 @@ exec386_dynarec_dyn(void) #endif CPU_BLOCK_END(); + if (cpu_end_block_after_ins) { + cpu_end_block_after_ins--; + if (!cpu_end_block_after_ins) + CPU_BLOCK_END(); + } + if (smi_line) CPU_BLOCK_END(); else if (cpu_state.flags & T_FLAG) CPU_BLOCK_END(); else if (nmi && nmi_enable && nmi_mask) CPU_BLOCK_END(); - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) + else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins) CPU_BLOCK_END(); - if (cpu_end_block_after_ins) { - cpu_end_block_after_ins--; - if (!cpu_end_block_after_ins) - CPU_BLOCK_END(); - } - if (cpu_state.abrt) { if (!(cpu_state.abrt & ABRT_EXPECTED)) codegen_block_remove(); @@ -683,7 +683,7 @@ exec386_dynarec_dyn(void) CPU_BLOCK_END(); else if (nmi && nmi_enable && nmi_mask) CPU_BLOCK_END(); - else if ((cpu_state.flags & I_FLAG) && pic.int_pending) + else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins) CPU_BLOCK_END(); if (cpu_end_block_after_ins) {