mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-26 07:43:36 +01:00
Introduce a memory shutdown lock.
This allows the debugger to access memory in a safe way that should never crash.
This commit is contained in:
1 parent
45e5f642da
commit
55403e42c2
8 files changed
+83
-2
No files matched your search
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/mutex.h"
|
||||
#include "Common/Common.h"
|
||||
#include "Common/MemoryUtil.h"
|
||||
#ifndef __SYMBIAN32__
|
||||
@@ -89,6 +90,8 @@ u32 g_MemorySize;
|
||||
// Used to store the PSP model on game startup.
|
||||
u32 g_PSPModel;
|
||||
|
||||
recursive_mutex g_shutdownLock;
|
||||
|
||||
// We don't declare the IO region in here since its handled by other means.
|
||||
static MemoryView views[] =
|
||||
{
|
||||
@@ -370,6 +373,7 @@ void DoState(PointerWrap &p)
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
lock_guard guard(g_shutdownLock);
|
||||
u32 flags = 0;
|
||||
|
||||
MemoryMap_Shutdown(flags);
|
||||
@@ -387,6 +391,21 @@ void Clear()
|
||||
memset(m_pVRAM, 0, VRAM_SIZE);
|
||||
}
|
||||
|
||||
// Wanting to avoid include pollution, MemMap.h is included a lot.
|
||||
MemoryInitedLock::MemoryInitedLock()
|
||||
{
|
||||
g_shutdownLock.lock();
|
||||
}
|
||||
MemoryInitedLock::~MemoryInitedLock()
|
||||
{
|
||||
g_shutdownLock.unlock();
|
||||
}
|
||||
|
||||
MemoryInitedLock Lock()
|
||||
{
|
||||
return MemoryInitedLock();
|
||||
}
|
||||
|
||||
static Opcode Read_Instruction(u32 address, bool resolveReplacements, Opcode inst)
|
||||
{
|
||||
if (!MIPS_IS_EMUHACK(inst.encoding)) {
|
||||
|
||||
Reference in new issue
Block a user