14天学习训练营导师课程:周贺贺《ARMv8/ARMv9架构-快速入门》
1. MMU(Memory Management Unit)
内存管理单元,MMU的意义在于将软件程序的虚拟地址转换为真实的物理地址。
2. MMU种类
- Secure EL1&0 translation regime, when EL2 is disabled
- Non-secure EL1&0 translation regime, when EL2 is disabled
- SECURE EL1&0 translation regime, when EL2 is enabled
- Non-secure EL1&0 translation regime, when EL2 is enabled
- Secure EL2&0 translation regime
- Non-secure EL2&0 translation regime
- Secure EL2 translation regime
- Non-secure EL2 translation regime
- Secure EL3 translation regime
3. 如何开启MMU
- 设置页表基地址TTBR
- 初始化MAIR_EL3
- 配置TCR_EL3
- 创建页表
- 使能MMU
4. MMU模型
5. 页表属性
PBHA, bits[62:59] : for FEAT_HPDS2
XN or UXN, bit[54] : Execute-never or Unprivileged execute-never
PXN, bit[53] : Privileged execute-never
Contiguous, bit[51] : translation table entry 是连续的,可以存在一个TLB Entry中
DBM, bit[51] : Dirty Bit Modifier
GP, bit[50] : for FEAT_BTI
nT, bit[16] : for FEAT_BBM
nG, bit[11] : 缓存在TLB中的翻译,是否使用ASID标识
AF, bit[10] : Access flag, AF=0后,第一次访问该页面时,会将该标志置为1
SH, bits[9:8] : shareable属性
AP[2:1], bit[7:6] : Data Access Permissions bits
NS, bit[5] : Non-secure bit
Attrlndx[2:0], bits[4:2]
6. 内存属性
R or W | Meaning |
---|---|
0b0 | No Allocate |
0b1 | Allocate |
dd | Meaning |
---|---|
0b00 | Device-nGnRnE memory |
0b01 | Device-nGnRE memory |
0b10 | Device-nGRE memory |
0b11 | Device-GRE memory |