diff options
| author | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2023-02-26 13:22:31 +0100 |
|---|---|---|
| committer | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2023-02-26 13:22:31 +0100 |
| commit | a164ca67174ba6179170dea573479f23122513cc (patch) | |
| tree | 88bd5afa1633449e0db867cb480b9d772c96c1f6 /kernel/src/devices/timer.c | |
| parent | 950649760927a7c33ddecd1944fd0ad20e731ee9 (diff) | |
process.c
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) |
