1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00

Kernel: Add Processor::is_bootstrap_processor() function, and use it. (#6871)

The variety of checks for Processor::id() == 0 could use some assistance
in the readability department. This change adds a new function to
represent this check, and replaces the comparison everywhere it's used.
This commit is contained in:
Brian Gianforcaro 2021-05-05 16:48:26 +00:00 committed by GitHub
parent 72a61fe137
commit 64b4e3f34b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View file

@ -153,7 +153,7 @@ UNMAP_AFTER_INIT void TimeManagement::initialize(u32 cpu)
void TimeManagement::set_system_timer(HardwareTimerBase& timer)
{
VERIFY(Processor::id() == 0); // This should only be called on the BSP!
VERIFY(Processor::is_bootstrap_processor()); // 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));
@ -269,7 +269,7 @@ UNMAP_AFTER_INIT 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::id() == 0) {
if (Processor::is_bootstrap_processor()) {
// TODO: Have the other CPUs call system_timer_tick directly
increment_time_since_boot_hpet();
}