加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

Linux内核内存管理分页级别

发布时间:2020-12-14 02:12:40 所属栏目:Linux 来源:网络整理
导读:我正在阅读Bovet和Cesati的“理解 Linux内核”一书.在第二章中,在“在Linux中进行分页”一书中,作者提到了如何使用32个没有启用PAE的体系结构来消除Page Middle和Upper Directories.我无法理解作者的意思. 他们的治疗方法已经松动,并没有很多直观的意义. For
我正在阅读Bovet和Cesati的“理解 Linux内核”一书.在第二章中,在“在Linux中进行分页”一书中,作者提到了如何使用32个没有启用PAE的体系结构来消除Page Middle和Upper Directories.我无法理解作者的意思.

他们的治疗方法已经松动,并没有很多直观的意义.

For 32-bit architectures with no Physical Address Extension,two paging levels are sufficient. Linux essentially eliminates the Page Upper Directory and the Page Middle Directory fields by saying that they contain zero bits. However,the positions of the Page Upper Directory and the Page Middle Directory in the sequence of pointers are kept so that the same code can work on 32-bit and 64-bit architectures. The kernel keeps a position for the Page Upper Directory and the Page Middle Directory by setting the number of entries in them to 1 and mapping these two entries into the proper entry of the Page Global Directory.

有人能以更可口的方式解释这一点吗?

解决方法

好吧,我认为这意味着内核总是使用4级页表,它可以容纳正常的32位,PAE和长模式.我认为它们在引用中的含义是PM4L和PDT只设置为一个条目的长度,它只指向下一个条目.这意味着在正常的32位中,你得到这个:

/-> Page table
PM4L -> PDT -> Page Directory --> Page table
                              -> Page table

但在PAE中,你得到了这个:

PM4L -> PDT -> 512 Page Directories -> 1024 Page tables

在长模式下,你得到这个:

PM4L -> 512 PDTs -> 512 Page Directories -> 1024 Page tables

但由于总共有4个级别,内核的其余部分具有跨32位,PAE和长模式的统一接口.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读