diff --git a/src/cpu/core_full/load.h b/src/cpu/core_full/load.h index 97e2b348..86634ccc 100644 --- a/src/cpu/core_full/load.h +++ b/src/cpu/core_full/load.h @@ -268,6 +268,10 @@ l_M_Ed: flags.type=t_UNKNOWN; CPU_IRET(false); LoadIP(); + if (GETFLAG(IF) && PIC_IRQCheck) { + SaveIP(); + return CBRET_NONE; + } goto nextopcode; case D_IRETd: flags.type=t_UNKNOWN; @@ -346,10 +350,9 @@ l_M_Ed: goto nextopcode; case D_STI: SETFLAGBIT(IF,true); - if (PIC_IRQCheck) { - SaveIP(); - PIC_runIRQs(); - LoadIP(); + if (GETFLAG(IF) && PIC_IRQCheck) { + LEAVECORE; + return CBRET_NONE; } goto nextopcode; case D_STC: diff --git a/src/cpu/core_full/save.h b/src/cpu/core_full/save.h index 9e849d18..a5e97eb1 100644 --- a/src/cpu/core_full/save.h +++ b/src/cpu/core_full/save.h @@ -103,9 +103,17 @@ switch (inst.code.save) { break; case S_FLGw: SETFLAGSw(inst.op1.w); + if (GETFLAG(IF) && PIC_IRQCheck) { + SaveIP(); + return CBRET_NONE; + } break; case S_FLGd: SETFLAGSd(inst.op1.d); + if (GETFLAG(IF) && PIC_IRQCheck) { + SaveIP(); + return CBRET_NONE; + } break; case 0: break;