mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +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:
parent
72a61fe137
commit
64b4e3f34b
4 changed files with 10 additions and 6 deletions
|
@ -475,7 +475,7 @@ UNMAP_AFTER_INIT Thread* Scheduler::create_ap_idle_thread(u32 cpu)
|
|||
{
|
||||
VERIFY(cpu != 0);
|
||||
// This function is called on the bsp, but creates an idle thread for another AP
|
||||
VERIFY(Processor::id() == 0);
|
||||
VERIFY(Processor::is_bootstrap_processor());
|
||||
|
||||
VERIFY(s_colonel_process);
|
||||
Thread* idle_thread = s_colonel_process->create_kernel_thread(idle_loop, nullptr, THREAD_PRIORITY_MIN, String::formatted("idle thread #{}", cpu), 1 << cpu, false);
|
||||
|
@ -497,8 +497,7 @@ void Scheduler::timer_tick(const RegisterState& regs)
|
|||
VERIFY(current_thread->current_trap()->regs == ®s);
|
||||
|
||||
#if !SCHEDULE_ON_ALL_PROCESSORS
|
||||
bool is_bsp = Processor::id() == 0;
|
||||
if (!is_bsp)
|
||||
if (!Processor::is_bootstrap_processor())
|
||||
return; // TODO: This prevents scheduling on other CPUs!
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue