From: Randy Thelen Subject: PAE, Elf headers, and Extended CR3 registers Date: Thu, 14 Sep 2006 00:40:25 -0700 Message-ID: <8FC6F306-7732-41A3-93D9-25CBC7B087D6@netapp.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Folks -- I'm trying to figure out why it makes sense to assume that if the elf header notes are present and they indicate the use of PAE then an extended CR3 register is present. /* * If we have ELF notes then PAE=yes implies that we must support * the extended cr3 syntax. Otherwise we need to find the * [extended-cr3] syntax in the __xen_guest string. */ dsi->pae_kernel = PAEKERN_no; if ( dsi->__elfnote_section ) { p = xen_elfnote_string(dsi, XEN_ELFNOTE_PAE_MODE); if ( p != NULL && strncmp(p, "yes", 3) == 0 ) dsi->pae_kernel = PAEKERN_extended_cr3; } else { p = xen_guest_lookup(dsi, XEN_ELFNOTE_PAE_MODE); if ( p != NULL && strncmp(p, "yes", 3) == 0 ) { dsi->pae_kernel = PAEKERN_yes; if ( !strncmp(p+4, "[extended-cr3]", 14) ) dsi->pae_kernel = PAEKERN_extended_cr3; } } Can someone explain why the assumption declared in the comment and the first if () clause makes sense? I would have expected the above to have been written as: dsi->pae_kernel = PAEKERN_no; p = NULL; if ( dsi->__elfnote_section ) { p = xen_elfnote_string(dsi, XEN_ELFNOTE_PAE_MODE); } else { p = xen_guest_lookup(dsi, XEN_ELFNOTE_PAE_MODE); } if ( p != NULL && strncmp(p, "yes", 3) == 0 ) { dsi->pae_kernel = PAEKERN_yes; if ( !strncmp(p+4, "[extended-cr3]", 14) ) dsi->pae_kernel = PAEKERN_extended_cr3; } This would ignore whether the "yes" came from the elf note or the guest string. -- Randy