[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:
parent
9bd14b5a24
commit
8f07b1a417
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user