Kernel: Make global scheduler depend on KernelCore

This commit is contained in:
Fernando Sahmkow 2020-02-13 22:04:10 -04:00 committed by FernandoS27
parent d4da52bbd9
commit 0728dfef84
4 changed files with 24 additions and 8 deletions

View file

@ -97,8 +97,8 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] s64 cycles_
}
struct KernelCore::Impl {
explicit Impl(Core::System& system)
: system{system}, global_scheduler{system}, synchronization{system} {}
explicit Impl(Core::System& system, KernelCore& kernel)
: system{system}, global_scheduler{kernel}, synchronization{system} {}
void Initialize(KernelCore& kernel) {
Shutdown();
@ -215,7 +215,7 @@ struct KernelCore::Impl {
Core::System& system;
};
KernelCore::KernelCore(Core::System& system) : impl{std::make_unique<Impl>(system)} {}
KernelCore::KernelCore(Core::System& system) : impl{std::make_unique<Impl>(system, *this)} {}
KernelCore::~KernelCore() {
Shutdown();
}
@ -265,6 +265,14 @@ const Kernel::GlobalScheduler& KernelCore::GlobalScheduler() const {
return impl->global_scheduler;
}
Kernel::Scheduler& KernelCore::Scheduler(std::size_t id) {
return impl->cores[id].Scheduler();
}
const Kernel::Scheduler& KernelCore::Scheduler(std::size_t id) const {
return impl->cores[id].Scheduler();
}
Kernel::PhysicalCore& KernelCore::PhysicalCore(std::size_t id) {
return impl->cores[id];
}