summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-12-30 06:40:38 +0100
committerbunnei <bunneidev@gmail.com>2021-12-31 00:50:45 +0100
commit3a89723d97b8e646cde569030057777813f4371c (patch)
treec08f00b1ebb21c3652f0e23ab28fe06c4678aa42 /src/core/hle/kernel/svc.cpp
parentMerge pull request #7635 from bunnei/set-heap-size (diff)
downloadyuzu-3a89723d97b8e646cde569030057777813f4371c.tar
yuzu-3a89723d97b8e646cde569030057777813f4371c.tar.gz
yuzu-3a89723d97b8e646cde569030057777813f4371c.tar.bz2
yuzu-3a89723d97b8e646cde569030057777813f4371c.tar.lz
yuzu-3a89723d97b8e646cde569030057777813f4371c.tar.xz
yuzu-3a89723d97b8e646cde569030057777813f4371c.tar.zst
yuzu-3a89723d97b8e646cde569030057777813f4371c.zip
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 63e2dff19..250ef9042 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -2027,6 +2027,25 @@ static ResultCode SignalToAddress(Core::System& system, VAddr address, Svc::Sign
count);
}
+static void SynchronizePreemptionState(Core::System& system) {
+ auto& kernel = system.Kernel();
+
+ // Lock the scheduler.
+ KScopedSchedulerLock sl{kernel};
+
+ // If the current thread is pinned, unpin it.
+ KProcess* cur_process = system.Kernel().CurrentProcess();
+ const auto core_id = GetCurrentCoreId(kernel);
+
+ if (cur_process->GetPinnedThread(core_id) == GetCurrentThreadPointer(kernel)) {
+ // Clear the current thread's interrupt flag.
+ GetCurrentThread(kernel).ClearInterruptFlag();
+
+ // Unpin the current thread.
+ cur_process->UnpinCurrentThread(core_id);
+ }
+}
+
static ResultCode SignalToAddress32(Core::System& system, u32 address, Svc::SignalType signal_type,
s32 value, s32 count) {
return SignalToAddress(system, address, signal_type, value, count);
@@ -2797,7 +2816,7 @@ static const FunctionDef SVC_Table_64[] = {
{0x33, SvcWrap64<GetThreadContext>, "GetThreadContext"},
{0x34, SvcWrap64<WaitForAddress>, "WaitForAddress"},
{0x35, SvcWrap64<SignalToAddress>, "SignalToAddress"},
- {0x36, nullptr, "SynchronizePreemptionState"},
+ {0x36, SvcWrap64<SynchronizePreemptionState>, "SynchronizePreemptionState"},
{0x37, nullptr, "Unknown"},
{0x38, nullptr, "Unknown"},
{0x39, nullptr, "Unknown"},