Skip to content

Commit

Permalink
#12: Fine-tune interrupt handler
Browse files Browse the repository at this point in the history
  • Loading branch information
kennystrawnmusic committed Sep 26, 2023
1 parent dda823c commit 93827ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/arch/x86_64/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ extern "x86-interrupt" fn task_sched(_: InterruptStackFrame) {
}
}

// ensure that the next CPU core runs the next process when it receives this interrupt
if PTABLE_IDX.load(Ordering::SeqCst) < (PTABLE.read().len() - 1) {
if PTABLE_IDX.load(Ordering::SeqCst) < (PTABLE.read().len()) {
// ensure that the next CPU core runs the next process when it receives this interrupt
PTABLE_IDX.fetch_add(1, Ordering::SeqCst);
} else {
// we've reached the end of PTABLE, so time to reset this
PTABLE_IDX.store(0, Ordering::SeqCst);
}

Expand Down

0 comments on commit 93827ba

Please sign in to comment.