[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.