ARM MMU 和 ARM Linux 页表遍历 [英] ARM MMU and ARM Linux page table walk
问题描述
我对 linux 如何利用 ARMv7 MMU 硬件进行 3 级页表遍历并不感到困惑.MMU 只有 2 个寄存器 ttbr0 和 ttbr1(一个用于内核,另一个用于用户空间).mmu是怎么知道linux的多级页表遍历的?
I am little confused about how linux takes advantage of ARMv7 MMU hardware for its 3 level page table walk. MMU has only 2 registers ttbr0 and ttbr1 (one for kernel and other for user-space). How does mmu know know multi-level page table walk of linux?
谢谢,高
推荐答案
如果虚拟地址的高 N
位都为零,则转换从 TTBR0
else 开始TTBR1
.N
来自 TTBCR
.TTBRn
寄存器包含一级表基址的物理地址.加载一级表的适当条目,条目的各个位确定转换是否使用二级表,如果是,则其物理地址是什么.
If the upper N
bits of the virtual address are all zero then the translation starts at TTBR0
else TTBR1
. N
comes from the TTBCR
. The TTBRn
registers contain the physical address of the base of the first-level table. The appropriate entry of the first-level table is loaded and various bits of the entry determine if the translation uses a second-level table and if so what its physical address is.
MMU 可以配置为使用短描述符(32 位物理地址)或长描述符(40 位物理地址).使用短描述符时,最多只能使用两级转换表.使用长描述符时,可以分为三个级别.
The MMU can be configured to use Short Descriptors (32-bit physical addresses) or Long Descriptors (40-bit physical addresses). When using short descriptors, at most only two-levels of translation table can be used. When using long descriptors, there can be three levels.
这会忽略第 2 阶段的翻译(管理程序).所有内容都记录在 ARMARM for v7-A&R 部分 B3.3 中:http://infocenter.arm.com/help/topic/com.arm.doc.ddi0406c/index.html
This ignores stage 2 translations (Hypervisors). All is documented in the ARMARM for v7-A&R section B3.3: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0406c/index.html
这篇关于ARM MMU 和 ARM Linux 页表遍历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!