mirror of
https://github.com/PabloMK7/citra.git
synced 2025-10-11 12:00:03 +00:00
core: De-globalize HLE lock (#7212)
This commit is contained in:
parent
83b329f6e1
commit
6ec079ede8
18 changed files with 66 additions and 92 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
@ -322,6 +323,10 @@ public:
|
|||
return n3ds_hw_caps;
|
||||
}
|
||||
|
||||
std::recursive_mutex& GetHLELock() {
|
||||
return hle_lock;
|
||||
}
|
||||
|
||||
/// Map of named ports managed by the kernel, which can be retrieved using the ConnectToPort
|
||||
std::unordered_map<std::string, std::shared_ptr<ClientPort>> named_ports;
|
||||
|
||||
|
@ -370,6 +375,15 @@ private:
|
|||
MemoryMode memory_mode;
|
||||
New3dsHwCapabilities n3ds_hw_caps;
|
||||
|
||||
/*
|
||||
* Synchronizes access to the internal HLE kernel structures, it is acquired when a guest
|
||||
* application thread performs a syscall. It should be acquired by any host threads that read or
|
||||
* modify the HLE kernel state. Note: Any operation that directly or indirectly reads from or
|
||||
* writes to the emulated memory is not protected by this mutex, and should be avoided in any
|
||||
* threads other than the CPU thread.
|
||||
*/
|
||||
std::recursive_mutex hle_lock;
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "core/hle/kernel/timer.h"
|
||||
#include "core/hle/kernel/vm_manager.h"
|
||||
#include "core/hle/kernel/wait_object.h"
|
||||
#include "core/hle/lock.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/plgldr/plgldr.h"
|
||||
|
||||
|
@ -2300,8 +2299,8 @@ MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70));
|
|||
void SVC::CallSVC(u32 immediate) {
|
||||
MICROPROFILE_SCOPE(Kernel_SVC);
|
||||
|
||||
// Lock the global kernel mutex when we enter the kernel HLE.
|
||||
std::lock_guard lock{HLE::g_hle_lock};
|
||||
// Lock the kernel mutex when we enter the kernel HLE.
|
||||
std::scoped_lock lock{kernel.GetHLELock()};
|
||||
|
||||
DEBUG_ASSERT_MSG(kernel.GetCurrentProcess()->status == ProcessStatus::Running,
|
||||
"Running threads from exiting processes is unimplemented");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue