mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
Fix sys_process_exit2 when SPUs are at av handler
This commit is contained in:
parent
1ed2055ec1
commit
a3f65084df
3 changed files with 45 additions and 5 deletions
|
@ -1396,7 +1396,36 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
||||||
return true;
|
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())
|
||||||
|
{
|
||||||
|
// Hack: allocate memory in case the emulator is stopping
|
||||||
|
auto area = vm::get(vm::any, addr & -0x10000, 0x10000);
|
||||||
|
|
||||||
|
if (area->flags & 0x100)
|
||||||
|
{
|
||||||
|
// For 4kb pages
|
||||||
|
utils::memory_protect(vm::base(addr & -0x1000), 0x1000, utils::protection::rw);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
area->falloc(addr & -0x10000, 0x10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lv2_obj::sleep(*cpu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
|
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/Memory/vm.h"
|
#include "Emu/Memory/vm.h"
|
||||||
#include "CPUThread.h"
|
#include "CPUThread.h"
|
||||||
|
|
|
@ -903,10 +903,8 @@ namespace vm
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<block_t> map(u32 addr, u32 size, u64 flags)
|
static std::shared_ptr<block_t> _map(u32 addr, u32 size, u64 flags)
|
||||||
{
|
{
|
||||||
vm::writer_lock lock(0);
|
|
||||||
|
|
||||||
if (!size || (size | addr) % 4096)
|
if (!size || (size | addr) % 4096)
|
||||||
{
|
{
|
||||||
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
|
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
|
||||||
|
@ -932,6 +930,13 @@ namespace vm
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<block_t> map(u32 addr, u32 size, u64 flags)
|
||||||
|
{
|
||||||
|
vm::writer_lock lock(0);
|
||||||
|
|
||||||
|
return _map(addr, size, flags);
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<block_t> find_map(u32 orig_size, u32 align, u64 flags)
|
std::shared_ptr<block_t> find_map(u32 orig_size, u32 align, u64 flags)
|
||||||
{
|
{
|
||||||
vm::writer_lock lock(0);
|
vm::writer_lock lock(0);
|
||||||
|
@ -1030,6 +1035,12 @@ namespace vm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (area_size)
|
||||||
|
{
|
||||||
|
lock.upgrade();
|
||||||
|
return _map(addr, area_size, 0x200);
|
||||||
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue