Page directory for a new process
Posted: Fri Sep 04, 2009 11:05 am
Hi all,
I'm currently trying to get my paging right and I'm standing in front of a wall right now.
When I spawn a new process later, I don't know how to set up a page directory for this process. All other OSs I've looked at just clone the kernel directory and use that clone as a first directory. I think this is too complicated and perhaps even wasted address space for the userspace programs and a security problem as well. Why do all userspace programs need to see the whole kernel stuff?
The other thing is, that the kernel directory might change during operation. Let's say you spawn a process just after the startup of the Kernel. The kernel does some heavy work and needs a few more frames for its heap or things like that. If I want that the userspace programs have the same kernel space in the upper GB (if I choose a 3/1 layout), I would need to keep this for all running directories in sync.
And what for? Just for an entry point for syscalls?
OK then I will put my syscall entrypoints at 0xFFFFE000 or something like that. Directly under the identity paging.
All this stuff does is switching to the kernel directory and jump then to the real syscall handler. Of course, this code needs to know the physical address of the kernel directory, but I could pass it to this trampoline code on startup-
One frame would be enough space for this realtively small piece of code.
After handling the syscall, I need to restore the old, and now perhaps modified, page directory again to the one the process used before.
I wouldn't need the whole upper GB.
Am I thinking right or is this totally wrong?
Thanks,
Andreas
I'm currently trying to get my paging right and I'm standing in front of a wall right now.
When I spawn a new process later, I don't know how to set up a page directory for this process. All other OSs I've looked at just clone the kernel directory and use that clone as a first directory. I think this is too complicated and perhaps even wasted address space for the userspace programs and a security problem as well. Why do all userspace programs need to see the whole kernel stuff?
The other thing is, that the kernel directory might change during operation. Let's say you spawn a process just after the startup of the Kernel. The kernel does some heavy work and needs a few more frames for its heap or things like that. If I want that the userspace programs have the same kernel space in the upper GB (if I choose a 3/1 layout), I would need to keep this for all running directories in sync.
And what for? Just for an entry point for syscalls?
OK then I will put my syscall entrypoints at 0xFFFFE000 or something like that. Directly under the identity paging.
All this stuff does is switching to the kernel directory and jump then to the real syscall handler. Of course, this code needs to know the physical address of the kernel directory, but I could pass it to this trampoline code on startup-
One frame would be enough space for this realtively small piece of code.
After handling the syscall, I need to restore the old, and now perhaps modified, page directory again to the one the process used before.
I wouldn't need the whole upper GB.
Am I thinking right or is this totally wrong?
Thanks,
Andreas