From ea65e8ce5a7f059e5995173102447627b3e4c1c8 Mon Sep 17 00:00:00 2001 From: eladash Date: Wed, 13 Mar 2019 12:12:25 +0200 Subject: [PATCH] Fix sys_process_exit2 when SPUs are at av handler --- Utilities/Thread.cpp | 19 ++++++++++++++++++- rpcs3/Emu/CPU/CPUThread.cpp | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 3bee4371732c..eb1d03b43140 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1394,7 +1394,24 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) return true; } - vm::temporary_unlock(*cpu); + if (cpu->id_type() == 2) + { + LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr); + + // TODO: + // RawSPU: Send appropriate interrupt + // SPUThread: Send sys_spu exception event + cpu->state += cpu_flag::dbg_pause; + if (cpu->check_state()) + { + static_cast(cpu)->cpu_stop(); + throw cpu_flag::exit; + } + } + else + { + lv2_obj::sleep(*cpu); + } } LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr); diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index ebb74ef0234d..7507a3ab3efb 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/System.h" #include "Emu/Memory/vm.h" #include "CPUThread.h"