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

@@ -160,6 +160,23 @@ static void intr_exception (struct saved_regs* regs) {
regs->error, regs->rip, regs->cs, regs->rflags, regs->rsp, regs->ss, cr2, cr3,
regs->rbx);
debugprintf ("call stack:\n");
uint64_t rbp = regs->rbp;
for (size_t depth = 0; depth < 20; depth++) {
if (rbp == 0)
break;
uint64_t rip = *(uint64_t*)(rbp + 8);
debugprintf (" #%d %016lx\n", depth, rip);
rbp = *(uint64_t*)rbp;
if (rbp == 0)
break;
}
if (regs->cs == (GDT_UCODE | 0x03)) {
struct reschedule_ctx rctx;
memset (&rctx, 0, sizeof (rctx));
@@ -200,14 +217,12 @@ void intr_handler (void* stack_ptr) {
struct proc* proc_current = thiscpu->proc_current;
if (proc_current != NULL) {
spin_lock (&proc_current->lock, &fpc);
memcpy (&proc_current->pdata.regs, regs, sizeof (struct saved_regs));
spin_lock (&proc_current->lock, &fpc);
memcpy (&proc_current->pdata.regs, regs, sizeof (struct saved_regs));
fx_save (proc_current->pdata.fx_env);
fx_save (proc_current->pdata.fx_env);
spin_unlock (&proc_current->lock, fpc);
}
spin_unlock (&proc_current->lock, fpc);
spin_unlock (&thiscpu->lock, ftc);
}