1
0
Fork 0
forked from suyu/suyu

Kernel: Remove global system accessor from WaitObject

This commit is contained in:
Fernando Sahmkow 2019-09-11 12:47:37 -04:00 committed by FernandoS27
parent 0cf26cee59
commit e05a8c2385
4 changed files with 17 additions and 2 deletions

View file

@ -229,6 +229,14 @@ const Kernel::GlobalScheduler& KernelCore::GlobalScheduler() const {
return impl->global_scheduler; return impl->global_scheduler;
} }
Core::System& KernelCore::System() {
return impl->system;
}
const Core::System& KernelCore::System() const {
return impl->system;
}
void KernelCore::AddNamedPort(std::string name, SharedPtr<ClientPort> port) { void KernelCore::AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
impl->named_ports.emplace(std::move(name), std::move(port)); impl->named_ports.emplace(std::move(name), std::move(port));
} }

View file

@ -82,6 +82,12 @@ public:
/// Gets the sole instance of the global scheduler /// Gets the sole instance of the global scheduler
const Kernel::GlobalScheduler& GlobalScheduler() const; const Kernel::GlobalScheduler& GlobalScheduler() const;
/// Gets the sole instance of the system
Core::System& System();
/// Gets the sole instance of the system
const Core::System& System() const;
/// Adds a port to the named port table /// Adds a port to the named port table
void AddNamedPort(std::string name, SharedPtr<ClientPort> port); void AddNamedPort(std::string name, SharedPtr<ClientPort> port);

View file

@ -287,7 +287,7 @@ void GlobalScheduler::PreemptThreads() {
if (current_thread != nullptr && current_thread->GetPriority() > priority) { if (current_thread != nullptr && current_thread->GetPriority() > priority) {
for (auto& thread : suggested_queue[core_id]) { for (auto& thread : suggested_queue[core_id]) {
const s32 source_core = thread->GetProcessorID(); const s32 source_core = thread->GetProcessorID();
if (thread->GetPriority() > priority) { if (thread->GetPriority() < priority) {
continue; continue;
} }
if (source_core >= 0) { if (source_core >= 0) {

View file

@ -8,6 +8,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_cpu.h" #include "core/core_cpu.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
@ -97,7 +98,7 @@ void WaitObject::WakeupWaitingThread(SharedPtr<Thread> thread) {
} }
if (resume) { if (resume) {
thread->ResumeFromWait(); thread->ResumeFromWait();
Core::System::GetInstance().PrepareReschedule(thread->GetProcessorID()); kernel.System().PrepareReschedule(thread->GetProcessorID());
} }
} }