summaryrefslogtreecommitdiffstats
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 4d16736f5..68a6b1ac2 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -11,6 +11,7 @@
#include "common/swap.h"
#include "core/hle/kernel/memory.h"
#include "core/hle/kernel/process.h"
+#include "core/hle/lock.h"
#include "core/memory.h"
#include "core/memory_setup.h"
#include "video_core/renderer_base.h"
@@ -123,6 +124,9 @@ T Read(const VAddr vaddr) {
return value;
}
+ // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
+ std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
+
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
@@ -161,6 +165,9 @@ void Write(const VAddr vaddr, const T data) {
return;
}
+ // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
+ std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
+
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
@@ -741,4 +748,4 @@ boost::optional<VAddr> PhysicalToVirtualAddress(const PAddr addr) {
return boost::none;
}
-} // namespace
+} // namespace Memory