summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-09-11 12:47:37 -0400
committerGravatar FernandoS272019-10-15 11:55:16 -0400
commite05a8c2385a68be6b1f6079c656fa46336546927 (patch)
tree39a6d0c1955c580f7db66a53fc5777cdc885e4b7 /src
parentScheduler: Implement Yield Count and Core migration on Thread Preemption. (diff)
downloadyuzu-e05a8c2385a68be6b1f6079c656fa46336546927.tar.gz
yuzu-e05a8c2385a68be6b1f6079c656fa46336546927.tar.xz
yuzu-e05a8c2385a68be6b1f6079c656fa46336546927.zip
Kernel: Remove global system accessor from WaitObject
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/kernel.cpp8
-rw-r--r--src/core/hle/kernel/kernel.h6
-rw-r--r--src/core/hle/kernel/scheduler.cpp2
-rw-r--r--src/core/hle/kernel/wait_object.cpp3
4 files changed, 17 insertions, 2 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 7a913520d..77edbcd1f 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -229,6 +229,14 @@ const Kernel::GlobalScheduler& KernelCore::GlobalScheduler() const {
229 return impl->global_scheduler; 229 return impl->global_scheduler;
230} 230}
231 231
232Core::System& KernelCore::System() {
233 return impl->system;
234}
235
236const Core::System& KernelCore::System() const {
237 return impl->system;
238}
239
232void KernelCore::AddNamedPort(std::string name, SharedPtr<ClientPort> port) { 240void KernelCore::AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
233 impl->named_ports.emplace(std::move(name), std::move(port)); 241 impl->named_ports.emplace(std::move(name), std::move(port));
234} 242}
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index f9f5bdc88..0fc4d1f36 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -82,6 +82,12 @@ public:
82 /// Gets the sole instance of the global scheduler 82 /// Gets the sole instance of the global scheduler
83 const Kernel::GlobalScheduler& GlobalScheduler() const; 83 const Kernel::GlobalScheduler& GlobalScheduler() const;
84 84
85 /// Gets the sole instance of the system
86 Core::System& System();
87
88 /// Gets the sole instance of the system
89 const Core::System& System() const;
90
85 /// Adds a port to the named port table 91 /// Adds a port to the named port table
86 void AddNamedPort(std::string name, SharedPtr<ClientPort> port); 92 void AddNamedPort(std::string name, SharedPtr<ClientPort> port);
87 93
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 5581c43bf..60d936c9a 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -287,7 +287,7 @@ void GlobalScheduler::PreemptThreads() {
287 if (current_thread != nullptr && current_thread->GetPriority() > priority) { 287 if (current_thread != nullptr && current_thread->GetPriority() > priority) {
288 for (auto& thread : suggested_queue[core_id]) { 288 for (auto& thread : suggested_queue[core_id]) {
289 const s32 source_core = thread->GetProcessorID(); 289 const s32 source_core = thread->GetProcessorID();
290 if (thread->GetPriority() > priority) { 290 if (thread->GetPriority() < priority) {
291 continue; 291 continue;
292 } 292 }
293 if (source_core >= 0) { 293 if (source_core >= 0) {
diff --git a/src/core/hle/kernel/wait_object.cpp b/src/core/hle/kernel/wait_object.cpp
index a65ec7dbc..50ed2a2f1 100644
--- a/src/core/hle/kernel/wait_object.cpp
+++ b/src/core/hle/kernel/wait_object.cpp
@@ -8,6 +8,7 @@
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/core.h" 9#include "core/core.h"
10#include "core/core_cpu.h" 10#include "core/core_cpu.h"
11#include "core/hle/kernel/kernel.h"
11#include "core/hle/kernel/object.h" 12#include "core/hle/kernel/object.h"
12#include "core/hle/kernel/process.h" 13#include "core/hle/kernel/process.h"
13#include "core/hle/kernel/thread.h" 14#include "core/hle/kernel/thread.h"
@@ -97,7 +98,7 @@ void WaitObject::WakeupWaitingThread(SharedPtr<Thread> thread) {
97 } 98 }
98 if (resume) { 99 if (resume) {
99 thread->ResumeFromWait(); 100 thread->ResumeFromWait();
100 Core::System::GetInstance().PrepareReschedule(thread->GetProcessorID()); 101 kernel.System().PrepareReschedule(thread->GetProcessorID());
101 } 102 }
102} 103}
103 104