The documentation states TTBR0 should be for user space and TTBR1 for kernel space basically.
My question and topic is basically what if I wanted to use TTBR0 for kernel space, and TTBR1 for user space? I can not seem to find the cons and pros of doing so.
The first mode basically lets bit 31 of the virtual address (or address) determine which paging table is used. For example mode 1 uses TTBR0 if bit 31 is zero and TTBR1 if bit 31 is one. This sounds simple enough. Basically splitting the address space into 2GB for the kernel space and 2GB for the user space.
Now, if I use mode 2. If bit 31:30 are zero then it uses TTBR0 and if bit 31:30 are anything other than zero than it uses TTBR1. This means TTBR1 can address 3GB of memory and TTBR0 can address 1GB.For N = 2; if VA[31:30] == 0b00 use TTBR0, otherwise use TTBR1
My problem is this seems odd because are we giving the kernel space 3GB and the user space 1GB? If we go by the docs and use TTBR0
See it says TTBR1 to be used for operating system, but if using mode 2 we just gave TTBR1 the ability to map 3GB.The expected use for these two page table base registers is for TTBR1 to be used for operating system and I/O addresses. These do not change on context switches. TTRB0 is used for process specific addresses with each process maintaining a separate first level page table. On a context switch TTBR0 and the ContextID register are modified
My point is I want to use TTBR1 for user space and TTBR0 for kernel space, but why do the docs seem to recommend to use TTBR1 for kernel space despite it having the ability to map 3GB?
Also, I am getting confused with this boundary issue. It seems changing the value of the N field not only effects which TTBR is used but also the boundary for the table. What in the world is going on? I bet there is a piece of this puzzle I am missing...
<edit>
I think I understand the boundary issue.... but the docs stating that they recommend using TTBR0 for user space (process specific) is confusing when it honestly seems like they wrote it backwards..
</edit>