Use strstr() to look for "bimodal" string in ELF notes, to allow guests to use
authorjohn.levon@sun.com <john.levon@sun.com>
Mon, 8 Jan 2007 20:54:41 +0000 (12:54 -0800)
committerjohn.levon@sun.com <john.levon@sun.com>
Mon, 8 Jan 2007 20:54:41 +0000 (12:54 -0800)
"yes,bimodal", so they are correctly identified as PAE on older hypervisors.

Signed-off-by: John Levon <john.levon@sun.com>
tools/libxc/xc_load_elf.c
xen/common/elf.c

index cabc164cca7660d47f5144c9e00db06e1b49ae7f..4d7d9823a53955f7598add009f08d4da17e9f224 100644 (file)
@@ -406,17 +406,19 @@ static int parseelfimage(const char *image,
     }
 
     /*
-     * A "bimodal" ELF note indicates the kernel will adjust to the
-     * current paging mode, including handling extended cr3 syntax.
-     * 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.
+     * A "bimodal" ELF note indicates the kernel will adjust to the current
+     * paging mode, including handling extended cr3 syntax.  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. We use strstr() to look for "bimodal" to allow guests to use
+     * "yes,bimodal" or "no,bimodal" for compatibility reasons.
      */
+
     dsi->pae_kernel = PAEKERN_no;
     if ( dsi->__elfnote_section )
     {
         p = xen_elfnote_string(dsi, XEN_ELFNOTE_PAE_MODE);
-        if ( p != NULL && strncmp(p, "bimodal", 7) == 0 )
+        if ( p != NULL && strstr(p, "bimodal") != NULL )
             dsi->pae_kernel = PAEKERN_bimodal;
         else if ( p != NULL && strncmp(p, "yes", 3) == 0 )
             dsi->pae_kernel = PAEKERN_extended_cr3;
index 6a55053e749efa79637bc345498968c930683dd0..8414f5e9334d6744ebbb639f4fa0e4f88329ee2f 100644 (file)
@@ -300,7 +300,7 @@ int parseelfimage(struct domain_setup_info *dsi)
     if ( dsi->__elfnote_section )
     {
         p = xen_elfnote_string(dsi, XEN_ELFNOTE_PAE_MODE);
-        if ( p != NULL && strncmp(p, "bimodal", 7) == 0 )
+        if ( p != NULL && strstr(p, "bimodal") != NULL )
             dsi->pae_kernel = PAEKERN_bimodal;
         else if ( p != NULL && strncmp(p, "yes", 3) == 0 )
             dsi->pae_kernel = PAEKERN_extended_cr3;