From ec8661f4314a3d56292a44570ea18180d2ab3464 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Thu, 30 Jun 2005 15:29:11 +0000 Subject: [PATCH] Fix a damn silly bug. On some occasions, we could have spcflags() set to EXEC_RETURN | HANDLE_INTERRUPT. And then, we handled the interrupt, but EXEC_RETURN was set so we returned very quickly without completing the interrupt routine. As a side effect, this occasionnaly hung the emulator most likely with {ethernet,audio}-based applications that trigger a lot of interrupts. The fix is to always honour EXEC_RETURN flag at first, of course. --- .../src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 c056e4ad..8588569b 100644 --- a/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp +++ b/SheepShaver/src/kpx_cpu/src/cpu/ppc/ppc-cpu.cpp @@ -451,6 +451,16 @@ void powerpc_registers::interrupt_copy(powerpc_registers &oregs, powerpc_registe bool powerpc_cpu::check_spcflags() { + if (spcflags().test(SPCFLAG_CPU_EXEC_RETURN)) { + spcflags().clear(SPCFLAG_CPU_EXEC_RETURN); +#ifndef SHEEPSHAVER + // FIXME: add unwind info to the translation cache? Otherwise + // we have to manually handle the exit syscall here + if (syscall_exit_code >= 0) + throw kernel_syscall_exit(syscall_exit_code); +#endif + return false; + } #ifdef SHEEPSHAVER if (spcflags().test(SPCFLAG_CPU_HANDLE_INTERRUPT)) { spcflags().clear(SPCFLAG_CPU_HANDLE_INTERRUPT); @@ -469,16 +479,6 @@ bool powerpc_cpu::check_spcflags() spcflags().set(SPCFLAG_CPU_HANDLE_INTERRUPT); } #endif - if (spcflags().test(SPCFLAG_CPU_EXEC_RETURN)) { - spcflags().clear(SPCFLAG_CPU_EXEC_RETURN); -#ifndef SHEEPSHAVER - // FIXME: add unwind info to the translation cache? Otherwise - // we have to manually handle the exit syscall here - if (syscall_exit_code >= 0) - throw kernel_syscall_exit(syscall_exit_code); -#endif - return false; - } if (spcflags().test(SPCFLAG_CPU_ENTER_MON)) { spcflags().clear(SPCFLAG_CPU_ENTER_MON); #if ENABLE_MON