|
内核2.6.11的页表两层映射 include/asm-i386/pgtable-2level-defs.h
代码如下:
- #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
- #define _I386_PGTABLE_2LEVEL_DEFS_H
- /*
- * traditional i386 two-level paging structure:
- */
- #define PGDIR_SHIFT 22
- #define PTRS_PER_PGD 1024
- /*
- * the i386 is two-level, so we don't really have any
- * PMD directory physically.
- */
- #define PTRS_PER_PTE 1024
- #endif /* _I386_PGTABLE_2LEVEL_DEFS_H */
复制代码
以及include/asm-i386/pgtable-3level-defs.h
- #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
- #define _I386_PGTABLE_3LEVEL_DEFS_H
- /*
- * PGDIR_SHIFT determines what a top-level page table entry can map
- */
- #define PGDIR_SHIFT 30
- #define PTRS_PER_PGD 4
- /*
- * PMD_SHIFT determines the size of the area a middle-level
- * page table can map
- */
- #define PMD_SHIFT 21
- #define PTRS_PER_PMD 512
- /*
- * entries per page directory level
- */
- #define PTRS_PER_PTE 512
- #endif /* _I386_PGTABLE_3LEVEL_DEFS_H */
复制代码
能有解释下三层映射为什么这么分,
PGDIR_SHIFT 30
才2位,PMD,PT都9位
那么offset对32位CPU是不是要12位啊 |
|