summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 9024f4922..72cbf2ec7 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -9,6 +9,7 @@
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/swap.h" 10#include "common/swap.h"
11#include "core/hle/kernel/process.h" 11#include "core/hle/kernel/process.h"
12#include "core/hle/lock.h"
12#include "core/memory.h" 13#include "core/memory.h"
13#include "core/memory_setup.h" 14#include "core/memory_setup.h"
14#include "core/mmio.h" 15#include "core/mmio.h"
@@ -187,6 +188,9 @@ T Read(const VAddr vaddr) {
187 return value; 188 return value;
188 } 189 }
189 190
191 // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
192 std::lock_guard<std::mutex> lock(HLE::g_hle_lock);
193
190 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 194 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
191 switch (type) { 195 switch (type) {
192 case PageType::Unmapped: 196 case PageType::Unmapped:
@@ -226,6 +230,9 @@ void Write(const VAddr vaddr, const T data) {
226 return; 230 return;
227 } 231 }
228 232
233 // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
234 std::lock_guard<std::mutex> lock(HLE::g_hle_lock);
235
229 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 236 PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
230 switch (type) { 237 switch (type) {
231 case PageType::Unmapped: 238 case PageType::Unmapped:
@@ -722,4 +729,4 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) {
722 return addr | 0x80000000; 729 return addr | 0x80000000;
723} 730}
724 731
725} // namespace 732} // namespace Memory