Scheduler fix, User RR

This commit is contained in:
2026-04-03 19:18:08 +02:00
parent 437bd0e751
commit 0240220796
7 changed files with 88 additions and 21 deletions
+15
View File
@@ -9,6 +9,9 @@
#include <kernel.h>
#include <stddef.h>
#include <io/term/term.h>
#include <sched/process.h>
extern struct process* current_process;
void sys_write(unsigned int fd, const char* buf, size_t count)
{
@@ -20,10 +23,19 @@ void sys_write(unsigned int fd, const char* buf, size_t count)
break;
case 2: //stderr
for (size_t i=0; i<count; i++) {
internal_putc(buf[i], NULL);
}
break;
}
}
void sys_exit(int error_code)
{
current_process->status = DEAD;
DEBUG("exiting process PID=%u name=%s", current_process->pid, current_process->name);
}
/*
* syscall_handler - System call dispatcher
* @regs: CPU state
@@ -53,6 +65,9 @@ struct cpu_status* syscall_handler(struct cpu_status* regs)
case 1: //sys_write
sys_write(regs->rdi, (char*)regs->rsi, regs->rdx);
break;
case 60: //sys_exit
sys_exit(regs->rdi);
break;
default:
regs->rax = 0xbad515ca11;
break;