cpu->proc_current cannot be NULL

This commit is contained in:
2026-03-20 23:54:04 +01:00
parent 187629b228
commit 7fa37ad6d7
8 changed files with 36 additions and 23 deletions

View File

@@ -14,7 +14,9 @@ int proc_sq_suspend (struct proc* proc, struct proc_suspension_q* sq, spin_lock_
uint64_t lockflags, struct reschedule_ctx* rctx) {
uint64_t fc, fp, fsq;
spin_lock (&proc->lock, &fp);
struct cpu* cpu = proc->cpu;
spin_unlock (&proc->lock, fp);
struct proc_sq_entry* sq_entry = malloc (sizeof (*sq_entry));
if (!sq_entry) {
@@ -44,9 +46,6 @@ int proc_sq_suspend (struct proc* proc, struct proc_suspension_q* sq, spin_lock_
list_remove (cpu->proc_run_q, &proc->cpu_run_q_link);
cpu->proc_run_q_count--;
if (cpu->proc_current == proc)
cpu->proc_current = NULL;
int state = proc->state;
spin_unlock (&sq->lock, fsq);
@@ -81,8 +80,6 @@ int proc_sq_resume (struct proc* proc, struct proc_sq_entry* sq_entry,
proc->state = PROC_READY;
list_append (cpu->proc_run_q, &proc->cpu_run_q_link);
if (cpu->proc_current == NULL)
cpu->proc_current = proc;
cpu->proc_run_q_count++;
int state = proc->state;