Phillip Susi wrote:
Hrm... are you saying that the page tables are shared,
but since the
page directory is not, a page fault can happen because the current
processes' page directory does not contain a PDE yet pointing to the
page table? That makes sense, but the page fault handler should
notice that the fault happened because the PDE is missing, and just
copy the PDE (if it exists) from the system process page directory.
As long as the page fault handler does that, then the process
management code will not need to do anything special.
Currently there exist two problems which cannot resolved by the
trap/page fault handler. The trap handler is invoked before the page
fault handler. The trap handler checks always for a stack under flow and
use the current thread entry from the pcr (PsGetCurrentThread). This
means, a page fault from the pcr's current thread entry cannot be
handled. While the thread switch code is execute, interrupts are only
disabled while the kernel stack is switched. There is a gap between
switching the stack and switching the page table. If the pde for the new
stack isn't valid for the old thread and the stack is accessed (by an
interrupt or a trap), it does occur a double fault.
- Hartmut