Add interfacing to the Global Scheduler
This commit is contained in:
parent
a1ac0c6cb4
commit
57a71f899a
|
@ -444,6 +444,16 @@ const Kernel::Scheduler& System::Scheduler(std::size_t core_index) const {
|
||||||
return CpuCore(core_index).Scheduler();
|
return CpuCore(core_index).Scheduler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the global scheduler
|
||||||
|
Kernel::GlobalScheduler& System::GlobalScheduler() {
|
||||||
|
return impl->kernel.GlobalScheduler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the global scheduler
|
||||||
|
const Kernel::GlobalScheduler& System::GlobalScheduler() const {
|
||||||
|
return impl->kernel.GlobalScheduler();
|
||||||
|
}
|
||||||
|
|
||||||
Kernel::Process* System::CurrentProcess() {
|
Kernel::Process* System::CurrentProcess() {
|
||||||
return impl->kernel.CurrentProcess();
|
return impl->kernel.CurrentProcess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace Kernel {
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
class Process;
|
class Process;
|
||||||
class Scheduler;
|
class Scheduler;
|
||||||
|
class GlobalScheduler;
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
namespace Loader {
|
namespace Loader {
|
||||||
|
@ -238,6 +239,12 @@ public:
|
||||||
/// Gets the scheduler for the CPU core with the specified index
|
/// Gets the scheduler for the CPU core with the specified index
|
||||||
const Kernel::Scheduler& Scheduler(std::size_t core_index) const;
|
const Kernel::Scheduler& Scheduler(std::size_t core_index) const;
|
||||||
|
|
||||||
|
/// Gets the global scheduler
|
||||||
|
Kernel::GlobalScheduler& GlobalScheduler();
|
||||||
|
|
||||||
|
/// Gets the global scheduler
|
||||||
|
const Kernel::GlobalScheduler& GlobalScheduler() const;
|
||||||
|
|
||||||
/// Provides a pointer to the current process
|
/// Provides a pointer to the current process
|
||||||
Kernel::Process* CurrentProcess();
|
Kernel::Process* CurrentProcess();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/process.h"
|
#include "core/hle/kernel/process.h"
|
||||||
#include "core/hle/kernel/resource_limit.h"
|
#include "core/hle/kernel/resource_limit.h"
|
||||||
|
#include "core/hle/kernel/scheduler.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
#include "core/hle/lock.h"
|
#include "core/hle/lock.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
@ -140,6 +141,7 @@ struct KernelCore::Impl {
|
||||||
// Lists all processes that exist in the current session.
|
// Lists all processes that exist in the current session.
|
||||||
std::vector<SharedPtr<Process>> process_list;
|
std::vector<SharedPtr<Process>> process_list;
|
||||||
Process* current_process = nullptr;
|
Process* current_process = nullptr;
|
||||||
|
Kernel::GlobalScheduler global_scheduler;
|
||||||
|
|
||||||
SharedPtr<ResourceLimit> system_resource_limit;
|
SharedPtr<ResourceLimit> system_resource_limit;
|
||||||
|
|
||||||
|
@ -203,6 +205,14 @@ const std::vector<SharedPtr<Process>>& KernelCore::GetProcessList() const {
|
||||||
return impl->process_list;
|
return impl->process_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kernel::GlobalScheduler& KernelCore::GlobalScheduler() {
|
||||||
|
return impl->global_scheduler;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Kernel::GlobalScheduler& KernelCore::GlobalScheduler() const {
|
||||||
|
return impl->global_scheduler;
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ class HandleTable;
|
||||||
class Process;
|
class Process;
|
||||||
class ResourceLimit;
|
class ResourceLimit;
|
||||||
class Thread;
|
class Thread;
|
||||||
|
class GlobalScheduler;
|
||||||
|
|
||||||
/// Represents a single instance of the kernel.
|
/// Represents a single instance of the kernel.
|
||||||
class KernelCore {
|
class KernelCore {
|
||||||
|
@ -75,6 +76,12 @@ public:
|
||||||
/// Retrieves the list of processes.
|
/// Retrieves the list of processes.
|
||||||
const std::vector<SharedPtr<Process>>& GetProcessList() const;
|
const std::vector<SharedPtr<Process>>& GetProcessList() const;
|
||||||
|
|
||||||
|
/// Gets the sole instance of the global scheduler
|
||||||
|
Kernel::GlobalScheduler& GlobalScheduler();
|
||||||
|
|
||||||
|
/// Gets the sole instance of the global scheduler
|
||||||
|
const Kernel::GlobalScheduler& GlobalScheduler() 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);
|
||||||
|
|
||||||
|
|
Reference in New Issue