For the time being allow page faults to happen when interrupts are

disabled, as long as a fault handler is installed for the thread. It
allows user_memcpy() to be invoked with interrupts disabled -- in this
case it will simply fail, when the address is valid, but not mapped yet.
This is a more desirable behavior for debug facilities, though in all
other cases it is likely a bug. We should probably introduce a thread
flag to discriminate these situations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27530 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-09-15 13:18:11 +00:00
parent e670fc6f63
commit 243300b289

View File

@ -849,8 +849,19 @@ page_fault_exception(struct iframe* frame)
"address %p from eip %p\n", (void *)cr2, (void *)frame->eip);
return;
} else if ((frame->flags & 0x200) == 0) {
// if the interrupts were disabled, and we are not running the kernel startup
// the page fault was not allowed to happen and we must panic
// interrupts disabled
// If a page fault handler is installed, we're allowed to be here.
// TODO: Now we are generally allowing user_memcpy() with interrupts
// disabled, which in most cases is a bug. We should add some thread
// flag allowing to explicitly indicate that this handling is desired.
if (thread && thread->fault_handler != 0) {
frame->eip = thread->fault_handler;
return;
}
// If we are not running the kernel startup the page fault was not
// allowed to happen and we must panic.
panic("page fault, but interrupts were disabled. Touching address "
"%p from eip %p\n", (void *)cr2, (void *)frame->eip);
return;