1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:07:35 +00:00

Kernel: Make Processor::id a static function

This eliminates the window between calling Processor::current and
the member function where a thread could be moved to another
processor. This is generally not as big of a concern as with
Processor::current_thread, but also slightly more light weight.
This commit is contained in:
Tom 2021-01-26 20:44:01 -07:00 committed by Andreas Kling
parent 21d288a10e
commit e2f9e557d3
7 changed files with 48 additions and 38 deletions

View file

@ -170,7 +170,7 @@ void TimeManagement::initialize(u32 cpu)
void TimeManagement::set_system_timer(HardwareTimerBase& timer)
{
ASSERT(Processor::current().id() == 0); // This should only be called on the BSP!
ASSERT(Processor::id() == 0); // This should only be called on the BSP!
auto original_callback = m_system_timer->set_callback(nullptr);
m_system_timer->disable();
timer.set_callback(move(original_callback));
@ -287,7 +287,7 @@ bool TimeManagement::probe_and_set_non_legacy_hardware_timers()
// Update the time. We don't really care too much about the
// frequency of the interrupt because we'll query the main
// counter to get an accurate time.
if (Processor::current().id() == 0) {
if (Processor::id() == 0) {
// TODO: Have the other CPUs call system_timer_tick directly
increment_time_since_boot_hpet();
}