WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] PAE, Elf headers, and Extended CR3 registers

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] PAE, Elf headers, and Extended CR3 registers
From: Randy Thelen <rthelen@xxxxxxxxxx>
Date: Thu, 14 Sep 2006 00:40:25 -0700
Delivery-date: Thu, 14 Sep 2006 03:20:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel