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.
Hartmut Birr wrote:
It isn't possible to share the page table in non
pae mode. The page
table contains the page directories for user and kernel mode. The page
directories for kernel mode are always shared except the hyperspace and
self mapped page table. On a task switch there is accessed the stack and
the thread/process structure of the next and/or the previous thread. A
page fault at this point is always a result of a missing page directory.
We can remove the call to MmUpdatePageDir before each task switch if we
do some changes:
- The kernel stack should never cross a page directory boundary (4MB).
- The old thread should access the stack and the thread/process
structure from the new thread before the thread pointer within the pcr
is changed. This may trigger a page fault and sets the page directory
within the page table of the old thread.
- The trap handler (KiTrapHandler) should check for a missing page
directory, befor PsGetCurrentThread is called.
- Hartmut