Completely avoid any form of nested interrupt processing.

This commit is contained in:
gbeauche 2005-06-30 09:09:59 +00:00
parent 55f5e3a41b
commit c9b044aeaf
2 changed files with 11 additions and 15 deletions

View File

@ -935,13 +935,7 @@ void HandleInterrupt(powerpc_registers *r)
if (int32(ReadMacInt32(XLM_IRQ_NEST)) > 0) if (int32(ReadMacInt32(XLM_IRQ_NEST)) > 0)
return; return;
// Do nothing if there is no pending interrupt // Update interrupt count
if (InterruptFlags == 0)
return;
// Current interrupt nest level
static int interrupt_depth = 0;
++interrupt_depth;
#if EMUL_TIME_STATS #if EMUL_TIME_STATS
interrupt_count++; interrupt_count++;
#endif #endif
@ -957,7 +951,7 @@ void HandleInterrupt(powerpc_registers *r)
#if INTERRUPTS_IN_NATIVE_MODE #if INTERRUPTS_IN_NATIVE_MODE
case MODE_NATIVE: case MODE_NATIVE:
// 68k emulator inactive, in nanokernel? // 68k emulator inactive, in nanokernel?
if (r->gpr[1] != KernelDataAddr && interrupt_depth == 1) { if (r->gpr[1] != KernelDataAddr) {
// Prepare for 68k interrupt level 1 // Prepare for 68k interrupt level 1
WriteMacInt16(tswap32(kernel_data->v[0x67c >> 2]), 1); WriteMacInt16(tswap32(kernel_data->v[0x67c >> 2]), 1);
@ -1015,9 +1009,6 @@ void HandleInterrupt(powerpc_registers *r)
break; break;
#endif #endif
} }
// We are done with this interrupt
--interrupt_depth;
} }
static void get_resource(void); static void get_resource(void);

View File

@ -454,10 +454,15 @@ bool powerpc_cpu::check_spcflags()
#ifdef SHEEPSHAVER #ifdef SHEEPSHAVER
if (spcflags().test(SPCFLAG_CPU_HANDLE_INTERRUPT)) { if (spcflags().test(SPCFLAG_CPU_HANDLE_INTERRUPT)) {
spcflags().clear(SPCFLAG_CPU_HANDLE_INTERRUPT); spcflags().clear(SPCFLAG_CPU_HANDLE_INTERRUPT);
powerpc_registers r; static bool processing_interrupt = false;
powerpc_registers::interrupt_copy(r, regs); if (!processing_interrupt) {
HandleInterrupt(&r); processing_interrupt = true;
powerpc_registers::interrupt_copy(regs, r); powerpc_registers r;
powerpc_registers::interrupt_copy(r, regs);
HandleInterrupt(&r);
powerpc_registers::interrupt_copy(regs, r);
processing_interrupt = false;
}
} }
if (spcflags().test(SPCFLAG_CPU_TRIGGER_INTERRUPT)) { if (spcflags().test(SPCFLAG_CPU_TRIGGER_INTERRUPT)) {
spcflags().clear(SPCFLAG_CPU_TRIGGER_INTERRUPT); spcflags().clear(SPCFLAG_CPU_TRIGGER_INTERRUPT);