参考:https://www.zhihu.com/column/c_1108400140804726784
传统的三级页表从上到下分为 PGD,PMD 和 PTE。后面引入了新的PUD( Page Upper Directory)。 PGD 依然保留为顶层的页表,同时将新级别插入在中间,即 PMD 级别的左边或者右边。基于该设计,最顶层都是 PGD,最底层也都是 PTE,
section mapping
参考:https://developer.arm.com/documentation/den0013/d/The-Memory-Management-Unit/First-level-address-translation
pfn : page frame number
PAGE_ALIGN
#define PAGE_ALIGN(addr)
如果addr处在一个页的起始地址,则返回值还是addr;否则返回下一个页的起始地址。
It rounds up an addr to the next multiple of 4096 (i.e. 212), by
adding 4095 (i.e. 212-1) to it and clearing the lowest 12 bits
O_PFN_UP
如果地址处在一个页的起始地址,则返回这个页的页号,否则返回下一个页的页号
宏V_PFN_UP
V_PFN_UP(x)获取虚拟地址x对应的物理地址,然后如果地址处在一个页的起始地址,则返回这个页的页号