[mem/task] Fix broken handling of page faults

The method I was using resulted in a loop of halts attempting
to remove process 0 from the thread queue if the kernel itself
was doing the faulting. This should fix that. Once there are
no more processes available, we bail out and call STOP.
This commit is contained in:
Kevin Lange 2011-11-29 07:02:05 -06:00
parent 9bd14b5a24
commit 8f07b1a417
2 changed files with 5 additions and 2 deletions

View File

@ -270,12 +270,14 @@ page_fault(
int reserved = r->err_code & 0x8;
int id = r->err_code & 0x10;
kprintf("\033[1;37;41m");
if (faulting_address == 0) {
kprintf("Null pointer dereference in the kernel.\n");
}
kprintf("Page fault! (p:%d,rw:%d,user:%d,res:%d,id:%d) at 0x%x\n", present, rw, user, reserved, id, faulting_address);
HALT_AND_CATCH_FIRE("Page fault", r);
HALT_AND_CATCH_FIRE("Page fault", NULL);
}
/*

View File

@ -178,7 +178,8 @@ switch_task() {
current_task = ready_queue;
}
if (!current_task) {
HALT_AND_CATCH_FIRE("Empty ready queue!", NULL);
kprintf("Ran out of processes to run. Halting!\n");
STOP;
}
eip = current_task->eip;
esp = current_task->esp;