Paging Idea for a Microkernel (not sure if it would work)
Posted: Wed Jun 22, 2016 10:16 am
Note: This may be a bad idea, but I'm not sure... it should *ONLY* work for a microkernel or a similar design...
Idea:
Let's say you have a page directory initialization function that creates a map of the current address space, giving a pointer that can be moved to CR3. What if the page directory for user processes does not map the kernel address space, AKA marking it as not present? On the event of a task switch or a software interrupt, for example, the task switch IRQ handler or the interrupt handler are already placed into user memory, running at CPL=0 when called so they can re-map the kernel-space as present. Once everything needed to be executed in the kernel and user-mode servers has run, the kernel remaps CR3 to not include kernel space every level of the software interrupt or task switch. While the kernel and the servers are communicating (IPC), they don't switch CR3 until they are *completely* finished (no one wants to make the system slower by adding too many CR3 swaps for no good reason).
This would involve work in the kernel to re-map many functions outside of it, which is a good thing for a microkernel design. Of course, there would need to be adequate memory protection for userspace as well.
This is, of course, a theoretical concept at the moment.
Idea:
Let's say you have a page directory initialization function that creates a map of the current address space, giving a pointer that can be moved to CR3. What if the page directory for user processes does not map the kernel address space, AKA marking it as not present? On the event of a task switch or a software interrupt, for example, the task switch IRQ handler or the interrupt handler are already placed into user memory, running at CPL=0 when called so they can re-map the kernel-space as present. Once everything needed to be executed in the kernel and user-mode servers has run, the kernel remaps CR3 to not include kernel space every level of the software interrupt or task switch. While the kernel and the servers are communicating (IPC), they don't switch CR3 until they are *completely* finished (no one wants to make the system slower by adding too many CR3 swaps for no good reason).
This would involve work in the kernel to re-map many functions outside of it, which is a good thing for a microkernel design. Of course, there would need to be adequate memory protection for userspace as well.
This is, of course, a theoretical concept at the moment.