summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2017-08-23 18:17:44 -0600
committerGitHub <noreply@github.com>2017-08-23 18:17:44 -0600
commit61442d6afba2f7528ddf3bbee64e8c2d86a4f4a8 (patch)
treeb4b16a86d9959e14c01e43f68400342d7224c5a8 /src/core/hle/svc.cpp
parent2bbff9fa962ffb3e03116e51ba8fb1778a4d10e5 (diff)
parentf484927ed03a1943a83f8781e598e07c056cc82a (diff)
Merge pull request #2839 from Subv/global_kernel_lock
Kernel/HLE: Use a mutex to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index e4b803046..b98938cb4 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -31,6 +31,7 @@
#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/service.h"
@@ -1188,7 +1189,7 @@ struct FunctionDef {
Func* func;
const char* name;
};
-}
+} // namespace
static const FunctionDef SVC_Table[] = {
{0x00, nullptr, "Unknown"},
@@ -1332,6 +1333,9 @@ MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70));
void CallSVC(u32 immediate) {
MICROPROFILE_SCOPE(Kernel_SVC);
+ // Lock the global kernel mutex when we enter the kernel HLE.
+ std::lock_guard<std::mutex> lock(HLE::g_hle_lock);
+
const FunctionDef* info = GetSVCInfo(immediate);
if (info) {
if (info->func) {
@@ -1342,4 +1346,4 @@ void CallSVC(u32 immediate) {
}
}
-} // namespace
+} // namespace SVC