From c9b044aeaf9aa4a42b85849e819ea630b2818e6a Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Thu, 30 Jun 2005 09:09:59 +0000 Subject: [PATCH] Completely avoid any form of nested interrupt processing. --- SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp | 13 ++----------- SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp index 65c71209..0ed289c9 100644 --- a/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp +++ b/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp @@ -935,13 +935,7 @@ void HandleInterrupt(powerpc_registers *r) if (int32(ReadMacInt32(XLM_IRQ_NEST)) > 0) return; - // Do nothing if there is no pending interrupt - if (InterruptFlags == 0) - return; - - // Current interrupt nest level - static int interrupt_depth = 0; - ++interrupt_depth; + // Update interrupt count #if EMUL_TIME_STATS interrupt_count++; #endif @@ -957,7 +951,7 @@ void HandleInterrupt(powerpc_registers *r) #if INTERRUPTS_IN_NATIVE_MODE case MODE_NATIVE: // 68k emulator inactive, in nanokernel? - if (r->gpr[1] != KernelDataAddr && interrupt_depth == 1) { + if (r->gpr[1] != KernelDataAddr) { // Prepare for 68k interrupt level 1 WriteMacInt16(tswap32(kernel_data->v[0x67c >> 2]), 1); @@ -1015,9 +1009,6 @@ void HandleInterrupt(powerpc_registers *r) break; #endif } - - // We are done with this interrupt - --interrupt_depth; } static void get_resource(void); diff --git a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp index 1c36b0b4..c056e4ad 100644 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp +++ b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp @@ -454,10 +454,15 @@ bool powerpc_cpu::check_spcflags() #ifdef SHEEPSHAVER if (spcflags().test(SPCFLAG_CPU_HANDLE_INTERRUPT)) { spcflags().clear(SPCFLAG_CPU_HANDLE_INTERRUPT); - powerpc_registers r; - powerpc_registers::interrupt_copy(r, regs); - HandleInterrupt(&r); - powerpc_registers::interrupt_copy(regs, r); + static bool processing_interrupt = false; + if (!processing_interrupt) { + processing_interrupt = true; + 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)) { spcflags().clear(SPCFLAG_CPU_TRIGGER_INTERRUPT);