feat(kernel): implement Phase 4 - preemptive multitasking, round-robin scheduler, PCB, x86_64 context switch & syscalls

This commit is contained in:
Adam Eehan committed 2026-10-23 17:36:52 +05:30
1 parent 7a584ea6e6
commit 6ee659ac6b
9 files changed
+444 -6

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
#include <airlys/syscall.h>
#include <airlys/sched.h>
#include <airlys/vga.h>
int64_t syscall_dispatch(uint64_t num, uint64_t arg1, uint64_t arg2, uint64_t arg3) {
(void)arg2;
(void)arg3;
switch (num) {
case SYS_YIELD:
task_yield();
return 0;
case SYS_EXIT:
task_exit();
return 0;
case SYS_SLEEP:
task_sleep(arg1);
return 0;
case SYS_PRINT:
if (arg1 != 0) {
vga_puts((const char*)arg1);
}
return 0;
case SYS_GETPID:
if (sched_get_current()) {
return (int64_t)sched_get_current()->pid;
}
return -1;
default:
return -1; /* Unknown syscall */
}
}
void syscall_init(void) {
/* Ready the syscall dispatch table */
}