diff options
Diffstat (limited to 'kernel/src/devices/timer.c')
| -rw-r--r-- | kernel/src/devices/timer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/src/devices/timer.c b/kernel/src/devices/timer.c index 0f6fc20..7971b20 100644 --- a/kernel/src/devices/timer.c +++ b/kernel/src/devices/timer.c @@ -4,8 +4,10 @@ #include <libk/list.h> #include <io.h> #include <idt.h> +#include <process.h> -uint32_t tick = 0; +uint32_t scheduler_ticks = 0; +uint32_t seconds_tick = 0; uint32_t seconds = 0; struct wait_queue { @@ -23,12 +25,16 @@ void timer_handler(uint64_t rsp) pos->ticks--; } - tick++; - - if (tick >= TICKS_PER_SECOND) { - tick = 0; + seconds_tick++; + if (seconds_tick >= TICKS_PER_SECOND) { + seconds_tick = 0; seconds++; } + scheduler_ticks++; + if (scheduler_ticks >= TICKS_PER_SECOND / CONTEXT_SWITCHES_PER_SECOND) { + scheduler_ticks = 0; +/* context_switch(rsp); */ + } } void wait(uint64_t ms) |
