summaryrefslogtreecommitdiff
path: root/Kernel/Scheduler.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-10-25 09:13:47 -0600
committerAndreas Kling <kling@serenityos.org>2020-10-25 21:18:35 +0100
commitfe615e601a95033c160b464728d8a0c195739f72 (patch)
treed9a60984028a82984ba7cb372ee2d76638826e75 /Kernel/Scheduler.cpp
parent9d347352a1a6c47867bc8340a13d69c8272952d9 (diff)
downloadserenity-fe615e601a95033c160b464728d8a0c195739f72.zip
Kernel: Set up and calibrate APIC timer, and enable timer on all CPUs
This enables the APIC timer on all CPUs, which means Scheduler::timer_tick is now called on all CPUs independently. We still don't do anything on the APs as it instantly crashes due to a number of other problems.
Diffstat (limited to 'Kernel/Scheduler.cpp')
-rw-r--r--Kernel/Scheduler.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index c510743b6b..e3e27900e5 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -777,15 +777,19 @@ void Scheduler::timer_tick(const RegisterState& regs)
ASSERT_INTERRUPTS_DISABLED();
ASSERT(Processor::current().in_irq());
- if (Processor::current().id() > 0)
- return;
auto current_thread = Processor::current().current_thread();
if (!current_thread)
return;
- ++g_uptime;
+ bool is_bsp = Processor::current().id() == 0;
+ if (!is_bsp)
+ return; // TODO: This prevents scheduling on other CPUs!
+ if (is_bsp) {
+ // TODO: We should probably move this out of the scheduler
+ ++g_uptime;
- g_timeofday = TimeManagement::now_as_timeval();
+ g_timeofday = TimeManagement::now_as_timeval();
+ }
if (current_thread->process().is_profiling()) {
SmapDisabler disabler;
@@ -799,7 +803,8 @@ void Scheduler::timer_tick(const RegisterState& regs)
}
}
- TimerQueue::the().fire();
+ if (is_bsp)
+ TimerQueue::the().fire();
if (current_thread->tick())
return;