1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-29 23:32:23 +00:00

kern: move scheduler/interrupt task manager out of core local region

This commit is contained in:
Michael Scire 2020-12-01 13:03:44 -08:00 committed by SciresM
parent bee629b8ad
commit aae565629e
4 changed files with 9 additions and 7 deletions

View file

@ -27,8 +27,6 @@ namespace ams::kern {
struct KCoreLocalContext { struct KCoreLocalContext {
KCurrentContext current; KCurrentContext current;
KScheduler scheduler;
KInterruptTaskManager interrupt_task_manager;
/* Everything after this point is for debugging. */ /* Everything after this point is for debugging. */
/* Retail kernel doesn't even consistently update these fields. */ /* Retail kernel doesn't even consistently update these fields. */
u64 num_sw_interrupts; u64 num_sw_interrupts;

View file

@ -74,6 +74,8 @@ namespace ams::kern {
static KUnsafeMemory s_unsafe_memory; static KUnsafeMemory s_unsafe_memory;
static KWorkerTaskManager s_worker_task_managers[KWorkerTaskManager::WorkerType_Count]; static KWorkerTaskManager s_worker_task_managers[KWorkerTaskManager::WorkerType_Count];
static KInterruptManager s_interrupt_manager; 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]; static KHardwareTimer s_hardware_timers[cpu::NumCores];
private: private:
static ALWAYS_INLINE KCoreLocalContext &GetCoreLocalContext() { static ALWAYS_INLINE KCoreLocalContext &GetCoreLocalContext() {
@ -99,15 +101,15 @@ namespace ams::kern {
} }
static ALWAYS_INLINE KScheduler &GetScheduler() { static ALWAYS_INLINE KScheduler &GetScheduler() {
return GetCoreLocalContext().scheduler; return s_schedulers[GetCurrentCoreId()];
} }
static ALWAYS_INLINE KScheduler &GetScheduler(s32 core_id) { static ALWAYS_INLINE KScheduler &GetScheduler(s32 core_id) {
return GetCoreLocalContext(core_id).scheduler; return s_schedulers[core_id];
} }
static ALWAYS_INLINE KInterruptTaskManager &GetInterruptTaskManager() { static ALWAYS_INLINE KInterruptTaskManager &GetInterruptTaskManager() {
return GetCoreLocalContext().interrupt_task_manager; return s_interrupt_task_managers[GetCurrentCoreId()];
} }
static ALWAYS_INLINE KInterruptManager &GetInterruptManager() { static ALWAYS_INLINE KInterruptManager &GetInterruptManager() {

View file

@ -49,8 +49,8 @@ namespace ams::kern {
/* Initialize current context. */ /* Initialize current context. */
clc->current.current_thread = nullptr; clc->current.current_thread = nullptr;
clc->current.current_process = nullptr; clc->current.current_process = nullptr;
clc->current.scheduler = std::addressof(clc->scheduler); clc->current.scheduler = std::addressof(Kernel::GetScheduler());
clc->current.interrupt_task_manager = std::addressof(clc->interrupt_task_manager); clc->current.interrupt_task_manager = std::addressof(Kernel::GetInterruptTaskManager());
clc->current.core_id = core_id; clc->current.core_id = core_id;
clc->current.exception_stack_top = GetVoidPointer(KMemoryLayout::GetExceptionStackTopAddress(core_id) - sizeof(KThread::StackParameters)); clc->current.exception_stack_top = GetVoidPointer(KMemoryLayout::GetExceptionStackTopAddress(core_id) - sizeof(KThread::StackParameters));

View file

@ -30,6 +30,8 @@ namespace ams::kern {
constinit KUnsafeMemory Kernel::s_unsafe_memory; constinit KUnsafeMemory Kernel::s_unsafe_memory;
constinit KWorkerTaskManager Kernel::s_worker_task_managers[KWorkerTaskManager::WorkerType_Count]; constinit KWorkerTaskManager Kernel::s_worker_task_managers[KWorkerTaskManager::WorkerType_Count];
constinit KInterruptManager Kernel::s_interrupt_manager; 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]; constinit KHardwareTimer Kernel::s_hardware_timers[cpu::NumCores];
namespace { namespace {