- 论坛徽章:
- 0
|
在ARM中一级页表有4096个目录项,用虚拟地址的高12位,再结合协处理器CP15的寄存器C2的高18位为基地址来索引一个目录项,一个目录项对应1M虚拟空间。
然而在看linux2.6.30内核源代码时发现一个奇怪的问题,为什么PGDIR_SHIFT定义为21,而不是20.
有如下定义:- #define PGDIR_SHIFT 21
- #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
- /* to find an entry in a page-table-directory */
- #define pgd_index(addr) ((addr) >> PGDIR_SHIFT)
- #define pgd_offset(mm, addr) ((mm)->pgd+pgd_index(addr))
- /* to find an entry in a kernel page-table-directory */
- #define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
- /* Find an entry in the second-level page table.. */
- #define pmd_offset(dir, addr) ((pmd_t *)(dir))
复制代码 |
|