Fix CPU load balancer bugs, scheduling points support for remote CPUs
All checks were successful
Build documentation / build-and-deploy (push) Successful in 28s

This commit is contained in:
2026-02-05 23:44:32 +01:00
parent 5283787a80
commit 5fe9d0a158
19 changed files with 129 additions and 79 deletions

View File

@@ -21,6 +21,7 @@ uintptr_t amd64_syscall_dispatch (void* stack_ptr) {
spin_lock (&thiscpu->lock, &ctxcpu);
struct proc* caller = thiscpu->proc_current;
int caller_pid = caller->pid;
spin_lock (&caller->lock, &ctxpr);
memcpy (&caller->pdata.regs, regs, sizeof (struct saved_regs));
@@ -35,7 +36,24 @@ uintptr_t amd64_syscall_dispatch (void* stack_ptr) {
return -ST_SYSCALL_NOT_FOUND;
}
return func (caller, regs, regs->rdi, regs->rsi, regs->rdx, regs->r10, regs->r8, regs->r9);
bool reschedule = false;
struct cpu* reschedule_cpu = NULL;
uintptr_t r = func (caller, regs, &reschedule, &reschedule_cpu, regs->rdi, regs->rsi, regs->rdx,
regs->r10, regs->r8, regs->r9);
caller = proc_find_pid (caller_pid);
if (caller != NULL) {
spin_lock (&caller->lock, &ctxpr);
caller->pdata.regs.rax = r;
spin_unlock (&caller->lock, &ctxpr);
}
if (reschedule)
cpu_request_sched (reschedule_cpu);
return r;
}
void syscall_init (void) {