From 85d7bba8392f7bcaf703413f68309ef912a5efe5 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 10 Dec 2015 17:35:03 +0200 Subject: [PATCH] Check interrupt level increase before executing any instructions. --- newcpu.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/newcpu.cpp b/newcpu.cpp index 5372facc..6aeae012 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -2330,6 +2330,8 @@ kludge_me_do: m68k_setpc (newpc); regs.ir = x_get_word (m68k_getpc ()); // prefetch 1 x_do_cycles (2 * cpucycleunit); + regs.ipl_pin = intlev(); + ipl_fetch(); regs.irc = x_get_word (m68k_getpc () + 2); // prefetch 2 #ifdef JIT set_special (SPCFLAG_END_COMPILE); @@ -2944,9 +2946,19 @@ static void do_interrupt (int nr) unset_special (SPCFLAG_STOP); assert (nr < 8 && nr >= 0); - Exception (nr + 24); + for (;;) { + Exception (nr + 24); + regs.intmask = nr; + if (!currprefs.cpu_compatible) + break; + if (m68k_interrupt_delay) + nr = regs.ipl; + else + nr = intlev(); + if (nr <= 0 || regs.intmask >= nr) + break; + } - regs.intmask = nr; doint (); } -- 2.47.3