syscalls: start trying to add nanosleep syscall

This commit is contained in:
2025-09-02 00:15:29 +03:00
parent a459751453
commit 5b922ea773
4 changed files with 38 additions and 1 deletions
+8
View File
@@ -4,6 +4,7 @@
#include "../include/string.h"
#include "../include/liballoc.h"
#include "../include/gdt.h"
#include "../include/isr.h"
#include <stddef.h>
@@ -67,6 +68,8 @@ Process* task_create(uint32_t func, uint32_t user_esp, uint32_t ring, uint32_t*
p->context->eip = (uint32_t)trapret;
p->kesp = (uint32_t)sp;
p->wake_up_time = 0;
p->next = 0;
if (!queue) {
@@ -133,6 +136,11 @@ void schedule() {
current = queue; // Start search from the beginning
}
if(current->wake_up_time > timer_ticks)
{
current = queue;
}
// Find the next ready process to run
Process* next = current ? current->next : NULL;
if (!next) next = queue;