[ros-dev] Kernel System Page Table
hartmut.birr at gmx.de
Sat Apr 23 21:46:42 CEST 2005
Alex Ionescu wrote:
> Hi Hartmut & Mm Experts,
> It seems that on ROS, every process has its own Page Table for the
> Kernel Area/System Table. This needs to be updated with
> MmUpdatePageDir all the time, and creates a bunch of annoyances in the
> Context Switching code too (for example, I can't check the trap frame
> for VM_MASK because at that time the Page Directory hasn't been
> changed yet. I could change it before but that would screw up the
> optimizations. Philip Susi and I have researched this and arrived to
> the common conclusion that every new Process's Page Table should share
> the same System Page Table. I'm not an expert so maybe I'm not
> explaining it properly, but the System Page Table shouldn't have to be
> "inserted/mapped" into every Process's Page Table, it should already
> be there, shared amongst all processes.
> I hope that made sense...if not, maybe Philip can fix up my explenation.
> Is it possible for any of the Mm guys to implement this properly?
> Thanks a lot..
> Best regards,
> Alex Ionescu
> Ros-dev mailing list
> Ros-dev at reactos.com
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.
More information about the Ros-dev