mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-30 13:24:16 +01:00
Kernel/Memory: Acquire the global HLE lock when a memory read/write operation falls outside of the fast path, for it might perform an MMIO operation.
This commit is contained in:
parent
bca8916cea
commit
f484927ed0
@ -9,6 +9,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/swap.h"
|
#include "common/swap.h"
|
||||||
#include "core/hle/kernel/process.h"
|
#include "core/hle/kernel/process.h"
|
||||||
|
#include "core/hle/lock.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
#include "core/memory_setup.h"
|
#include "core/memory_setup.h"
|
||||||
#include "core/mmio.h"
|
#include "core/mmio.h"
|
||||||
@ -187,6 +188,9 @@ T Read(const VAddr vaddr) {
|
|||||||
return value;
|
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::mutex> lock(HLE::g_hle_lock);
|
||||||
|
|
||||||
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PageType::Unmapped:
|
case PageType::Unmapped:
|
||||||
@ -226,6 +230,9 @@ void Write(const VAddr vaddr, const T data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
|
||||||
|
std::lock_guard<std::mutex> lock(HLE::g_hle_lock);
|
||||||
|
|
||||||
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PageType::Unmapped:
|
case PageType::Unmapped:
|
||||||
@ -722,4 +729,4 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) {
|
|||||||
return addr | 0x80000000;
|
return addr | 0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace Memory
|
||||||
|
Loading…
Reference in New Issue
Block a user