Kernel: All processors use LAPIC timer when running with APIC
This makes scheduler preemption much cleaner as bsb does not have to send smp messages to notify other processes about timer interrupt. Also PIT percision is now "full" 0.8 us instead of 1 ms that I was using before.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <kernel/ACPI/ACPI.h>
|
||||
#include <kernel/APIC.h>
|
||||
#include <kernel/Arch.h>
|
||||
#include <kernel/BootInfo.h>
|
||||
#include <kernel/Debug.h>
|
||||
@@ -167,6 +168,12 @@ extern "C" void kernel_main(uint32_t boot_magic, uint32_t boot_info)
|
||||
Random::initialize();
|
||||
dprintln("RNG initialized");
|
||||
|
||||
if (InterruptController::get().is_using_apic())
|
||||
{
|
||||
SystemTimer::get().dont_invoke_scheduler();
|
||||
static_cast<APIC&>(InterruptController::get()).initialize_timer();
|
||||
}
|
||||
|
||||
Processor::wait_until_processors_ready();
|
||||
MUST(Processor::scheduler().initialize());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user