{"id":308,"date":"2009-10-31T08:05:14","date_gmt":"2009-10-31T16:05:14","guid":{"rendered":"http:\/\/www.pagetable.com\/?p=308"},"modified":"2009-10-31T08:05:14","modified_gmt":"2009-10-31T16:05:14","slug":"pceptpdpte","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=308","title":{"rendered":"PCEPTPDPTE"},"content":{"rendered":"<p>Here is a new pagetable entry.<\/p>\n<p>I like Intel. I told you before <a href=\"http:\/\/www.pagetable.com\/?p=14\">how Intel messed up the x86 register nomenclature<\/a> by extending A to AX (A extended) and then to EAX (extended A extended). Then AMD came and extended the register once more, giving it a more sane name: RAX.<\/p>\n<p>I also told you before how Intel messed up the x86 pagetable nomenclature: There were pagetables (PT, level 1) and page directories (PD, level 2) on the i386, and for the Pentium Pro, they added page directory pointers (PDP, level 3). Then AMD came and extended it once more, giving it a more sane name: page map level 4 (PML4).<\/p>\n<p>With the advent of virtualization, both Intel and AMD added a feature to get rid of the slow software shadow pagetables, and added hardware support for nested pagetables, i.e. the guest has 4 levels of pagetables, and the host has another 4 levels.<\/p>\n<p>AMD called these &#8211; surprise, surprise! &#8211; nested pagetables, NPT. Intel was more creative. With a history of extending architectures, they went with the big E: extended pagetables, EPT.<\/p>\n<p>Let&#8217;s practice a bit: A PD is a page directory, a PDE is a page directory entry. You can also call it a PDPTE, a page directory pagetable entry (level 2 PTE), because after all, all these entries on all levels are PTEs, because they share the same format. A PDPPTE is a page directory pointer pagetable entry, aka level 3 entry.<\/p>\n<p>If we use nested paging &#8211; excuse me &#8211; extended paging on Intel, we need to prepend EPT to our nice little abbreviations. An EPTPTE is a level 1 entry, an EPTPDPTE is level 2 not to be confused with an EPTPDPPTE, which is level 3, and a level 4 entry is EPTPML4PTE.<\/p>\n<p>It get even better. Oracle\/Sun\/Innotek <a href=\"http:\/\/www.virtualbox.org\/\">VirtualBox<\/a> uses Hungarian Notation for its variable names, so it prepends &#8220;P&#8221; for pointer and &#8220;C&#8221; for constant. So what would you call a variable, which is a pointer to a constant level 2 EPT entry?<\/p>\n<p>Of course, <a href=\"http:\/\/www.virtualbox.org\/svn\/vbox\/trunk\/include\/VBox\/hwacc_vmx.h\">PCEPTPDPTE<\/a>.<\/p>\n<pre>\n\/** Pointer to a const EPT Page Directory Pointer Entry. *\/\ntypedef const EPTPDPTE *PCEPTPDPTE;\n<\/pre>\n<p>I thought about this for a while, and considered patenting this brilliant idea of mine, but here it is, free of patents and free for everyone to use: Michael&#8217;s nomenclature for Intel\/AMD pagetables:<\/p>\n<table border=\"1\">\n<tr>\n<th>new name<\/th>\n<th>description<\/th>\n<th>old name<\/th>\n<tr>\n<td>P4<\/td>\n<td>pagetable level 4 page<\/td>\n<td>PML4<\/td>\n<tr>\n<td>P3<\/td>\n<td>pagetable level 3 page<\/td>\n<td>PDP<\/td>\n<tr>\n<td>P2<\/td>\n<td>pagetable level 2 page<\/td>\n<td>PD<\/td>\n<tr>\n<td>P1<\/td>\n<td>pagetable level 1 page<\/td>\n<td>PT<\/td>\n<tr>\n<td>P4E<\/td>\n<td>pagetable level 4 entry<\/td>\n<td>PML4E\/PML4PTE<\/td>\n<tr>\n<td>P3E<\/td>\n<td>pagetable level 3 entry<\/td>\n<td>PDPE\/PDPPTE<\/td>\n<tr>\n<td>P2E<\/td>\n<td>pagetable level 2 entry<\/td>\n<td>PDE\/PDPTE<\/td>\n<tr>\n<td>P1E<\/td>\n<td>pagetable level 1 entry<\/td>\n<td>PTE<\/td>\n<tr>\n<td>NP4<\/td>\n<td>nested pagetable level 4 page<\/td>\n<td>EPTPML4<\/td>\n<tr>\n<td>NP3<\/td>\n<td>nested pagetable level 3 page<\/td>\n<td>EPTPDP<\/td>\n<tr>\n<td>NP2<\/td>\n<td>nested pagetable level 2 page<\/td>\n<td>EPTPD<\/td>\n<tr>\n<td>NP1<\/td>\n<td>nested pagetable level 1 page<\/td>\n<td>EPTPT<\/td>\n<tr>\n<td>NP4E<\/td>\n<td>nested pagetable level 4 entry<\/td>\n<td>EPTPML4E\/EPTPML4PTE<\/td>\n<tr>\n<td>NP3E<\/td>\n<td>nested pagetable level 3 entry<\/td>\n<td>EPTPDPE\/EPTPDPPTE<\/td>\n<tr>\n<td>NP2E<\/td>\n<td>nested pagetable level 2 entry<\/td>\n<td>EPTPDE\/EPTPDPTE<\/td>\n<tr>\n<td>NP1E<\/td>\n<td>nested pagetable level 1 entry<\/td>\n<td>EPTPTE<\/td>\n<\/table>\n<p>You are welcome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a new pagetable entry. I like Intel. I told you before how Intel messed up the x86 register nomenclature by extending A to AX (A extended) and then to EAX (extended A extended). Then AMD came and extended the register once more, giving it a more sane name: RAX. I also told you &#8230; <a title=\"PCEPTPDPTE\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=308\" aria-label=\"Read more about PCEPTPDPTE\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,36,38],"tags":[],"class_list":["post-308","post","type-post","status-publish","format-standard","hentry","category-trivia","category-whines","category-x86"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=308"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/308\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}