kern: implement more of KInterruptManager

This commit is contained in:
Michael Scire
2020-02-05 14:07:51 -08:00
parent 62de3322ff
commit 5f857cb079
17 changed files with 579 additions and 39 deletions

View File

@@ -32,8 +32,16 @@ namespace ams::kern::arm64 {
}
};
}
namespace {
/* One global hardware timer interrupt task per core. */
KHardwareTimerInterruptTask g_hardware_timer_interrupt_tasks[cpu::NumCores];
impl::KHardwareTimerInterruptTask g_hardware_timer_interrupt_tasks[cpu::NumCores];
ALWAYS_INLINE auto *GetHardwareTimerInterruptTask(s32 core_id) {
return std::addressof(g_hardware_timer_interrupt_tasks[core_id]);
}
}
@@ -41,7 +49,8 @@ namespace ams::kern::arm64 {
/* Setup the global timer for the core. */
InitializeGlobalTimer();
/* TODO: Bind the interrupt task for this core to the interrupt manager. */
/* Bind the interrupt task for this core. */
Kernel::GetInterruptManager().BindHandler(GetHardwareTimerInterruptTask(core_id), KInterruptName_HardwareTimerEl1, core_id, KInterruptController::PriorityLevel_Timer, true, true);
}
void KHardwareTimer::Finalize() {
@@ -63,7 +72,9 @@ namespace ams::kern::arm64 {
EnableInterrupt();
}
}
/* TODO: Clear the timer interrupt. */
/* Clear the timer interrupt. */
Kernel::GetInterruptManager().ClearInterrupt(KInterruptName_HardwareTimerEl1, GetCurrentCoreId());
}
}