summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-07-03 18:30:51 +0200
committerAnton Kling <anton@kling.gg>2024-07-03 18:30:51 +0200
commit4e7918753175dbd8fc38bc7c5b176517e1dbef2f (patch)
tree723b3b3503d7502f3ce5338aeb6964cb5fa4c246 /kernel/sched
parent658c4e9645bf46268ed13bf5ef76d0ba60a347b9 (diff)
Kernel/Time: Improve time keeping
This makes use of TSC and now provides a file system interface for userland programs to change the system time.
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/scheduler.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/sched/scheduler.c b/kernel/sched/scheduler.c
index c8ee0a1..10ecd73 100644
--- a/kernel/sched/scheduler.c
+++ b/kernel/sched/scheduler.c
@@ -7,7 +7,9 @@
#include <errno.h>
#include <fs/vfs.h>
#include <interrupts.h>
+#include <sched/scheduler.h>
#include <signal.h>
+#include <timer.h>
// FIXME: Use the process_t struct instead or keep this contained in it.
TCB *current_task_TCB;
@@ -432,6 +434,7 @@ extern PageDirectory *active_directory;
process_t *next_task(process_t *s) {
process_t *c = s;
+ u64 ms_time = timer_get_ms();
c = c->next;
for (;; c = c->next) {
if (!c) {
@@ -440,7 +443,7 @@ process_t *next_task(process_t *s) {
if (s == c) {
// wait_for_interrupt();
}
- if (c->sleep_until > pit_num_ms()) {
+ if (c->sleep_until > ms_time) {
continue;
}
if (c->is_interrupted) {