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

[Xen-changelog] Export xen_section info from generic Elf parser. Use this to detect



ChangeSet 1.1697, 2005/06/08 10:19:22+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Export xen_section info from generic Elf parser. Use this to detect
        PAE mismatch between Xen and dom0 image.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/ia64/domain.c      |    6 +++---
 arch/x86/domain_build.c |   20 ++++++++++++++++++--
 common/elf.c            |   18 ++----------------
 include/xen/sched.h     |    2 +-
 4 files changed, 24 insertions(+), 22 deletions(-)


diff -Nru a/xen/arch/ia64/domain.c b/xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c    2005-06-08 06:03:24 -04:00
+++ b/xen/arch/ia64/domain.c    2005-06-08 06:03:24 -04:00
@@ -823,14 +823,14 @@
 
     /* Temp workaround */
     if (running_on_sim)
-       dsi.xen_elf_image = 1;
+       dsi.xen_section_string = (char *)1;
 
-    if ((!vmx_enabled) && !dsi.xen_elf_image) {
+    if ((!vmx_enabled) && !dsi.xen_section_string) {
        printk("Lack of hardware support for unmodified vmx dom0\n");
        panic("");
     }
 
-    if (vmx_enabled && !dsi.xen_elf_image) {
+    if (vmx_enabled && !dsi.xen_section_string) {
        printk("Dom0 is vmx domain!\n");
        vmx_dom0 = 1;
     }
diff -Nru a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       2005-06-08 06:03:24 -04:00
+++ b/xen/arch/x86/domain_build.c       2005-06-08 06:03:24 -04:00
@@ -74,7 +74,7 @@
                    unsigned long _initrd_start, unsigned long initrd_len,
                    char *cmdline)
 {
-    int i, rc;
+    int i, rc, dom0_pae, xen_pae;
     unsigned long pfn, mfn;
     unsigned long nr_pages;
     unsigned long nr_pt_pages;
@@ -122,7 +122,8 @@
     unsigned long mpt_alloc;
 
     extern void physdev_init_dom0(struct domain *);
-    extern void translate_l2pgtable(struct domain *d, l1_pgentry_t *p2m, 
unsigned long l2mfn);
+    extern void translate_l2pgtable(
+        struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
 
     /* Sanity! */
     if ( d->domain_id != 0 ) 
@@ -149,6 +150,21 @@
 
     if ( (rc = parseelfimage(&dsi)) != 0 )
         return rc;
+
+    if ( dsi.xen_section_string == NULL )
+    {
+        printk("Not a Xen-ELF image: '__xen_guest' section not found.\n");
+        return -EINVAL;
+    }
+
+    dom0_pae = !!strstr(dsi.xen_section_string, "PAE=yes");
+    xen_pae  = (CONFIG_PAGING_LEVELS == 3);
+    if ( dom0_pae != xen_pae )
+    {
+        printk("PAE mode mismatch between Xen and DOM0 (xen=%s, dom0=%s)\n",
+               xen_pae ? "yes" : "no", dom0_pae ? "yes" : "no");
+        return -EINVAL;
+    }
 
     /* Align load address to 4MB boundary. */
     dsi.v_start &= ~((1UL<<22)-1);
diff -Nru a/xen/common/elf.c b/xen/common/elf.c
--- a/xen/common/elf.c  2005-06-08 06:03:24 -04:00
+++ b/xen/common/elf.c  2005-06-08 06:03:24 -04:00
@@ -11,12 +11,6 @@
 #include <xen/elf.h>
 #include <xen/sched.h>
 
-#ifdef CONFIG_X86
-#define FORCE_XENELF_IMAGE 1
-#elif defined(__ia64__)
-#define FORCE_XENELF_IMAGE 0
-#endif
-
 static void loadelfsymtab(struct domain_setup_info *dsi, int doload);
 static inline int is_loadable_phdr(Elf_Phdr *phdr)
 {
@@ -85,16 +79,8 @@
 
         break;
     }
-    if ( guestinfo == NULL )
-    {
-        printk("Not a Xen-ELF image: '__xen_guest' section not found.\n");
-       dsi->xen_elf_image = 0;
-#if FORCE_XENELF_IMAGE
-        return -EINVAL;
-#endif
-    } else {
-       dsi->xen_elf_image = 1;
-    }
+
+    dsi->xen_section_string = guestinfo;
 
     for ( h = 0; h < ehdr->e_phnum; h++ ) 
     {
diff -Nru a/xen/include/xen/sched.h b/xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   2005-06-08 06:03:24 -04:00
+++ b/xen/include/xen/sched.h   2005-06-08 06:03:24 -04:00
@@ -155,7 +155,7 @@
     unsigned long symtab_addr;
     unsigned long symtab_len;
     /* Indicate whether it's xen specific image */
-    unsigned int xen_elf_image;
+    char *xen_section_string;
 };
 
 extern struct domain idle0_domain;

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


 


Rackspace

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