Spinlock save cpu flags

This commit is contained in:
2026-03-12 22:48:34 +01:00
parent 19793e9126
commit 4760818118
50 changed files with 704 additions and 461 deletions

View File

@@ -191,20 +191,22 @@ void intr_handler (void* stack_ptr) {
if (regs->trap <= 31) {
intr_exception (regs);
} else {
spin_lock (&thiscpu->lock);
uint64_t ftc, fpc;
spin_lock (&thiscpu->lock, &ftc);
struct proc* proc_current = thiscpu->proc_current;
if (proc_current != NULL) {
spin_lock (&proc_current->lock);
spin_lock (&proc_current->lock, &fpc);
memcpy (&proc_current->pdata.regs, regs, sizeof (struct saved_regs));
fx_save (proc_current->pdata.fx_env);
spin_unlock (&proc_current->lock);
spin_unlock (&proc_current->lock, fpc);
}
spin_unlock (&thiscpu->lock);
spin_unlock (&thiscpu->lock, ftc);
lapic_eoi ();