mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-14 11:07:52 +01:00
kern: move scheduler/interrupt task manager out of core local region
This commit is contained in:
parent
bee629b8ad
commit
aae565629e
@ -27,8 +27,6 @@ namespace ams::kern {
|
||||
|
||||
struct KCoreLocalContext {
|
||||
KCurrentContext current;
|
||||
KScheduler scheduler;
|
||||
KInterruptTaskManager interrupt_task_manager;
|
||||
/* Everything after this point is for debugging. */
|
||||
/* Retail kernel doesn't even consistently update these fields. */
|
||||
u64 num_sw_interrupts;
|
||||
|
@ -74,6 +74,8 @@ namespace ams::kern {
|
||||
static KUnsafeMemory s_unsafe_memory;
|
||||
static KWorkerTaskManager s_worker_task_managers[KWorkerTaskManager::WorkerType_Count];
|
||||
static KInterruptManager s_interrupt_manager;
|
||||
static KScheduler s_schedulers[cpu::NumCores];
|
||||
static KInterruptTaskManager s_interrupt_task_managers[cpu::NumCores];
|
||||
static KHardwareTimer s_hardware_timers[cpu::NumCores];
|
||||
private:
|
||||
static ALWAYS_INLINE KCoreLocalContext &GetCoreLocalContext() {
|
||||
@ -99,15 +101,15 @@ namespace ams::kern {
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE KScheduler &GetScheduler() {
|
||||
return GetCoreLocalContext().scheduler;
|
||||
return s_schedulers[GetCurrentCoreId()];
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE KScheduler &GetScheduler(s32 core_id) {
|
||||
return GetCoreLocalContext(core_id).scheduler;
|
||||
return s_schedulers[core_id];
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE KInterruptTaskManager &GetInterruptTaskManager() {
|
||||
return GetCoreLocalContext().interrupt_task_manager;
|
||||
return s_interrupt_task_managers[GetCurrentCoreId()];
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE KInterruptManager &GetInterruptManager() {
|
||||
|
@ -49,8 +49,8 @@ namespace ams::kern {
|
||||
/* Initialize current context. */
|
||||
clc->current.current_thread = nullptr;
|
||||
clc->current.current_process = nullptr;
|
||||
clc->current.scheduler = std::addressof(clc->scheduler);
|
||||
clc->current.interrupt_task_manager = std::addressof(clc->interrupt_task_manager);
|
||||
clc->current.scheduler = std::addressof(Kernel::GetScheduler());
|
||||
clc->current.interrupt_task_manager = std::addressof(Kernel::GetInterruptTaskManager());
|
||||
clc->current.core_id = core_id;
|
||||
clc->current.exception_stack_top = GetVoidPointer(KMemoryLayout::GetExceptionStackTopAddress(core_id) - sizeof(KThread::StackParameters));
|
||||
|
||||
|
@ -30,6 +30,8 @@ namespace ams::kern {
|
||||
constinit KUnsafeMemory Kernel::s_unsafe_memory;
|
||||
constinit KWorkerTaskManager Kernel::s_worker_task_managers[KWorkerTaskManager::WorkerType_Count];
|
||||
constinit KInterruptManager Kernel::s_interrupt_manager;
|
||||
constinit KScheduler Kernel::s_schedulers[cpu::NumCores];
|
||||
constinit KInterruptTaskManager Kernel::s_interrupt_task_managers[cpu::NumCores];
|
||||
constinit KHardwareTimer Kernel::s_hardware_timers[cpu::NumCores];
|
||||
|
||||
namespace {
|
||||
|
Loading…
Reference in New Issue
Block a user