summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-11-18 23:44:19 -0500
committerGravatar Zach Hilman2018-11-18 23:44:19 -0500
commit409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a (patch)
treeccb9eae7c7e8b93760f3087fb6e67a13cbb24f2c /src/core/hle/kernel/svc.cpp
parentMerge pull request #1717 from FreddyFunk/swizzle-gob (diff)
downloadyuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.gz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.xz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.zip
svc: Implement yield types 0 and -1
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 75dbfc31d..467575c93 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -962,16 +962,39 @@ static void SleepThread(s64 nanoseconds) {
962 962
963 // Don't attempt to yield execution if there are no available threads to run, 963 // Don't attempt to yield execution if there are no available threads to run,
964 // this way we avoid a useless reschedule to the idle thread. 964 // this way we avoid a useless reschedule to the idle thread.
965 if (nanoseconds == 0 && !Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) 965 if (!Core::System::GetInstance().CurrentScheduler().HaveReadyThreads())
966 return; 966 return;
967 967
968 if (nanoseconds <= 0) {
969 switch (nanoseconds) {
970 case 0:
971 GetCurrentThread()->YieldNormal();
972 break;
973 case -1:
974 GetCurrentThread()->YieldWithLoadBalancing();
975 break;
976 case -2:
977 GetCurrentThread()->YieldAndWaitForLoadBalancing();
978 break;
979 default:
980 UNREACHABLE_MSG(
981 "Unimplemented sleep yield type '{:016X}'! Falling back to forced reschedule...",
982 nanoseconds);
983 }
984
985 nanoseconds = 0;
986 }
987
968 // Sleep current thread and check for next thread to schedule 988 // Sleep current thread and check for next thread to schedule
969 WaitCurrentThread_Sleep(); 989 WaitCurrentThread_Sleep();
970 990
971 // Create an event to wake the thread up after the specified nanosecond delay has passed 991 // Create an event to wake the thread up after the specified nanosecond delay has passed
972 GetCurrentThread()->WakeAfterDelay(nanoseconds); 992 GetCurrentThread()->WakeAfterDelay(nanoseconds);
973 993
974 Core::System::GetInstance().PrepareReschedule(); 994 Core::System::GetInstance().CpuCore(0).PrepareReschedule();
995 Core::System::GetInstance().CpuCore(1).PrepareReschedule();
996 Core::System::GetInstance().CpuCore(2).PrepareReschedule();
997 Core::System::GetInstance().CpuCore(3).PrepareReschedule();
975} 998}
976 999
977/// Wait process wide key atomic 1000/// Wait process wide key atomic