kernel/handle_table: Remove usages of the global system instance

Removes even more usages of the global system instance, trimming away
more dependencies on global variables and making them explicit in the
interface.
This commit is contained in:
Lioncash
2020-07-15 13:18:03 -04:00
parent 4ad69ca96e
commit 52e83f0d5c
4 changed files with 15 additions and 8 deletions

View File

@ -8,8 +8,9 @@
#include "core/core.h"
#include "core/hle/kernel/errors.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h"
namespace Kernel {
@ -23,7 +24,7 @@ constexpr u16 GetGeneration(Handle handle) {
}
} // Anonymous namespace
HandleTable::HandleTable() {
HandleTable::HandleTable(KernelCore& kernel) : kernel{kernel} {
Clear();
}
@ -104,9 +105,9 @@ bool HandleTable::IsValid(Handle handle) const {
std::shared_ptr<Object> HandleTable::GetGeneric(Handle handle) const {
if (handle == CurrentThread) {
return SharedFrom(Core::System::GetInstance().CurrentScheduler().GetCurrentThread());
return SharedFrom(kernel.CurrentScheduler().GetCurrentThread());
} else if (handle == CurrentProcess) {
return SharedFrom(Core::System::GetInstance().CurrentProcess());
return SharedFrom(kernel.CurrentProcess());
}
if (!IsValid(handle)) {