summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-19 05:44:19 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-19 05:44:19 +0100
commit409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a (patch)
treeccb9eae7c7e8b93760f3087fb6e67a13cbb24f2c /src/core/hle/kernel/svc.cpp
parentMerge pull request #1717 from FreddyFunk/swizzle-gob (diff)
downloadyuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.gz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.bz2
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.lz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.xz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.zst
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.zip
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) {
// Don't attempt to yield execution if there are no available threads to run,
// this way we avoid a useless reschedule to the idle thread.
- if (nanoseconds == 0 && !Core::System::GetInstance().CurrentScheduler().HaveReadyThreads())
+ if (!Core::System::GetInstance().CurrentScheduler().HaveReadyThreads())
return;
+ if (nanoseconds <= 0) {
+ switch (nanoseconds) {
+ case 0:
+ GetCurrentThread()->YieldNormal();
+ break;
+ case -1:
+ GetCurrentThread()->YieldWithLoadBalancing();
+ break;
+ case -2:
+ GetCurrentThread()->YieldAndWaitForLoadBalancing();
+ break;
+ default:
+ UNREACHABLE_MSG(
+ "Unimplemented sleep yield type '{:016X}'! Falling back to forced reschedule...",
+ nanoseconds);
+ }
+
+ nanoseconds = 0;
+ }
+
// Sleep current thread and check for next thread to schedule
WaitCurrentThread_Sleep();
// Create an event to wake the thread up after the specified nanosecond delay has passed
GetCurrentThread()->WakeAfterDelay(nanoseconds);
- Core::System::GetInstance().PrepareReschedule();
+ Core::System::GetInstance().CpuCore(0).PrepareReschedule();
+ Core::System::GetInstance().CpuCore(1).PrepareReschedule();
+ Core::System::GetInstance().CpuCore(2).PrepareReschedule();
+ Core::System::GetInstance().CpuCore(3).PrepareReschedule();
}
/// Wait process wide key atomic