diff --git a/kernel/src/arch/Timer.cpp b/kernel/src/arch/Timer.cpp index 8df3c058..e564c492 100644 --- a/kernel/src/arch/Timer.cpp +++ b/kernel/src/arch/Timer.cpp @@ -2,8 +2,10 @@ #include "Log.h" #include "arch/Serial.h" #include "boot/bootboot.h" +#include -// FIXME: Storing these values as unsigned integers doesn't allow for pre-epoch times. +// NOTE: Storing these values as unsigned integers doesn't allow for pre-epoch times. +// We are in 2023 anyway, not sure why anybody would want to set their computer's time to 1945. static u64 timer_ticks = 0; static u64 boot_timestamp; @@ -134,8 +136,9 @@ namespace Timer } } +static_assert(IsPowerOfTwo, "ARCH_TIMER_FREQ must be a power of two"); + bool should_invoke_scheduler() { - // FIXME: Modulo is SLOW. We're calling this every tick. return (timer_ticks % ARCH_TIMER_FREQ) == 0; } diff --git a/kernel/src/arch/x86_64/Timer.h b/kernel/src/arch/x86_64/Timer.h index 6ab40002..b3955f7c 100644 --- a/kernel/src/arch/x86_64/Timer.h +++ b/kernel/src/arch/x86_64/Timer.h @@ -1,4 +1,4 @@ #pragma once #include -const usize ARCH_TIMER_FREQ = 5; +const usize ARCH_TIMER_FREQ = 4;