multi-cpu scheduling WIP
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user