multi-cpu scheduling WIP

This commit is contained in:
2026-01-25 15:54:00 +01:00
parent 7bb3b77ede
commit 95f590fb3b
23 changed files with 103 additions and 61 deletions

View File

@@ -15,25 +15,27 @@ extern void amd64_syscall_entry (void);
int amd64_syscall_dispatch (void* stack_ptr) {
spin_lock_ctx_t ctxcpu;
spin_lock (&thiscpu->lock, &ctxcpu);
amd64_load_kernel_cr3 ();
struct saved_regs* regs = stack_ptr;
spin_lock (&thiscpu->lock, &ctxcpu);
memcpy (&thiscpu->regs, regs, sizeof (struct saved_regs));
spin_unlock (&thiscpu->lock, &ctxcpu);
int syscall_num = regs->rax;
syscall_handler_func_t func = syscall_find_handler (syscall_num);
if (func == NULL)
if (func == NULL) {
spin_unlock (&thiscpu->lock, &ctxcpu);
return -ST_SYSCALL_NOT_FOUND;
}
struct proc* caller = thiscpu->proc_current;
spin_unlock (&thiscpu->lock, &ctxcpu);
int result = func (caller, regs, regs->rdi, regs->rsi, regs->rdx, regs->r10, regs->r8, regs->r9);
return result;
}