简体   繁体   English

Linux中的三级页面表

[英]three level page table in linux

I know that linux uses three level page tables in memory management. 我知道linux在内存管理中使用三级页表。

I got confused on the content of the page table.Does page table contains next level page tables base address or it contains page frame number? 我对页面表的内容感到困惑。页面表是否包含下一级页面表的基地址或页面页号?

If it contains page frame number then how base address for that particular page table is got?Where is it stored? 如果它包含页框号,那么该特定页表的基地址如何获得?它存储在哪里?

Would be greatful if someone clarified this to me. 如果有人向我澄清这一点将是非常感谢。

If you're talking about x86(/64), then every page table entry (except the terminal one) contains the physical address of the next page table, and the terminal PTE contains the physical address of the actual code/data page. 如果您在谈论x86(/ 64),那么每个页表项(终端1除外)都包含下一页表的物理地址,而终端PTE则包含实际代码/数据页的物理地址。

Since page tables are organized as pages themselves, their physical addresses are naturally multiples of the page size. 由于页表本身是作为页组织的,因此它们的物理地址自然是页大小的倍数。

It makes little sense to store full physical addresses in PTEs with the 12 least significant bits being always zero (in case the page size is 4KB), and so they aren't stored in the PTEs (and the recovered space in the PTEs is used for control flags such as kernel/user, read-only/writable, executable, present, dirty, accessed, etc). 在12个最低有效位始终为零的情况下(在页面大小为4KB的情况下)在PTE中存储完整的物理地址几乎没有意义,因此它们没有存储在PTE中(并且使用了PTE中的恢复空间)用于控制标志,例如内核/用户,只读/可写,可执行,存在,脏,访问等)。 Addresses truncated like that are commonly called page frame numbers because they are nothing else but page numbers (if you count all pages from 0 for the page at address 0, 1 for the page at address 4096 and so on). 像这样被截断的地址通常被称为页框架号,因为它们不过是页号(如果您将所有页从0计为地址0的页,将1计为地址4096的页,依此类推)。

The ultimate answer to your question with all the gory details is in the relevant CPU manual. 有关所有问题的最终答案,请参见相关的CPU手册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM