pgd_index(PAGE_OFFSET)
pgd_index(0xC0000000) = 768
根据线性地址 address,计算该地址所对应的页目录表项:
#define
pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
#define PGDIR_SHIFT 22
#define PTRS_PER_PGD 1024
PTRS_PER_PGD-1 11 1111 1111
PAGE_OFFSET = 0xC0000000
#define
PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#ifdef __ASSEMBLY__
#define
__PAGE_OFFSET (0xC0000000)
#else
#define
__PAGE_OFFSET (0xC0000000UL)
#endif
pgd_index(0xC0000000) = 768
根据线性地址 address,计算该地址所对应的页目录表项:
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
#define PGDIR_SHIFT 22
#define PTRS_PER_PGD 1024
PAGE_OFFSET = 0xC0000000
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)