Hi, Martin,
At Tue, 05 Nov 2013 16:27:30 +0100, Martin Stein wrote:
On 05.11.2013 15:59, Neal H. Walfield wrote:
At Tue, 05 Nov 2013 15:15:49 +0100, Martin Stein wrote:
The single "kernel"-thread executes solely in privileged CPU mode. Initially it disables the MMU and runs in physical address space. Before leaving privileged CPU mode the first time, it enables the MMU, using the address space of the root-task (core). Thus both, threads of the non-privileged root-task and the single "kernel" thread use the same virtual address space. For the purpose of simplification "kernel" thread and root-task threads also share data structures (e.g. raw page-tables or the interrupt-lookup table). This must be done carefully because "kernel" thread can always interrupt root-task threads and access shared objects without synchronization.
If I understand correctly, you are basically implementing a fail fast mechanism for the root task.
Thus, the root task can, say, walk the page tables, but to modify the page tables or to switch protection domains, it traps to the kernel? Similarly, I'm guessing the kernel doesn't walk any of the root task's data structure (or, it does so very conservatively).
By now the "kernel" thread creates the root-task page-table at start-up in a way, that it contains 1:1 mappings for all physical regions that are ever needed by root-task or kernel. Thus root-task threads and the kernel thread never throw page-faults and access resources in virtual space via their physical addresses. This way we keep things simple while benefit from several performance features the ARM MMU provides. As a result of this, root-task never touches its own page table. If root-task threads want to create further page tables they use a syscall. During this syscall, kernel initializes the page table with generic stuff. After that, application-specific control of the new page table is in the hands of the root-task threads.
Thanks for the details!
:) Neal