v0.5.3: syscalls, minilibc.

- fix(gs): was a nightmare. now its solved. Both MSR_GS_BASE and MSR_KERNEL_GS_BASE are now initialized to , preventing null GS_BASE when interrupt occurs during the first kernel task run
- chore(syscall.asm): stability improvements. User RSP is now saved via kernel stack instead of global g_cpu, preventing stack theft when task switch occurs during a syscall
- feat(interrupts): all irq and isr handlers now conditionally perform swapgs based on the CS selector (checkin if comfing from ring 3)
- upgrade(scheduler): big update: 1) added TASK_BLOCKED state from process sync; 2) syncronized PID and Task ID to fix wakeup logic; 3) implemented sched_block and sched_exit() for proper wait/exit syscalls
This commit is contained in:
Karina
2026-01-30 07:12:57 +04:00
parent 888bc5abdd
commit caf2d2b4a8
18 changed files with 122 additions and 41 deletions
+5 -3
View File
@@ -6,7 +6,9 @@
#include <malloc.h>
int main() {
printf("Launching debug\n");
spawn("debug");
while (1) {}
wait(spawn("debug"));
printf("\nStill here?\n");
while (1) {
printf("1");
}
}
+2 -1
View File
@@ -4,4 +4,5 @@
#pragma once
#include <types.h>
u64 spawn(const char* path);
u64 spawn(const char* path);
u64 wait(u64 pid);
+5
View File
@@ -4,7 +4,12 @@
#include <process.h>
extern u64 sys_spawn(const char* path);
extern u64 sys_wait(u64 pid);
u64 spawn(const char* path) {
return sys_spawn(path);
}
u64 wait(u64 pid) {
return sys_wait(pid);
}
+6
View File
@@ -10,6 +10,7 @@ global sys_spawn
global sys_mem
global sys_write
global sys_read
global sys_wait
sys_exit:
mov rax, 0
@@ -35,3 +36,8 @@ sys_read:
mov rax, 4
syscall
ret
sys_wait:
mov rax, 5
syscall
ret