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

[Xen-changelog] [LOADER] Remove check for VIRT_BASE existence: it's not needed



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 4dcb93547710d1071e6d2e77c6d7b7890760fb4a
# Parent  d081a485f34bc074b56828e95b7c5a5c123c5c37
[LOADER] Remove check for VIRT_BASE existence: it's not needed
to prevent xend crashign (when Aravindh's latest patch is
applied) and breaks ia64. Also, ensure we set a reasonable
default for elf_paddr_offset.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_load_elf.c |   25 ++++++++++++++-----------
 xen/common/elf.c          |   14 +++++++++++---
 2 files changed, 25 insertions(+), 14 deletions(-)

diff -r d081a485f34b -r 4dcb93547710 tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Sat May 20 16:25:28 2006 +0100
+++ b/tools/libxc/xc_load_elf.c Sun May 21 09:55:15 2006 +0100
@@ -148,14 +148,9 @@ static int parseelfimage(const char *ima
 
     dsi->xen_guest_string = guestinfo;
 
-    if ( (p = strstr(guestinfo, "VIRT_BASE=")) == NULL )
-    {
-        ERROR("Malformed ELF image. No VIRT_BASE specified");
-        return -EINVAL;
-    }
-
-    virt_base = strtoul(p+10, &p, 0);
-
+    virt_base = 0;
+    if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL )
+        virt_base = strtoul(p+10, &p, 0);
     dsi->elf_paddr_offset = virt_base;
     if ( (p = strstr(guestinfo, "ELF_PADDR_OFFSET=")) != NULL )
         dsi->elf_paddr_offset = strtoul(p+17, &p, 0);
@@ -172,10 +167,18 @@ static int parseelfimage(const char *ima
             kernend = vaddr + phdr->p_memsz;
     }
 
-    if ( virt_base )
-        dsi->v_start = virt_base;
-    else
+    dsi->v_start = virt_base;
+    if ( dsi->v_start == 0 )
+    {
+        /*
+         * Legacy compatibility and images with no __xen_guest section:
+         * assume header addresses are virtual addresses, and that 
+         * guest memory should be mapped starting at kernel load address.
+         */
         dsi->v_start = kernstart;
+        if ( dsi->elf_paddr_offset == 0 )
+            dsi->elf_paddr_offset = dsi->v_start;
+    }
 
     dsi->v_kernentry = ehdr->e_entry;
     if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL )
diff -r d081a485f34b -r 4dcb93547710 xen/common/elf.c
--- a/xen/common/elf.c  Sat May 20 16:25:28 2006 +0100
+++ b/xen/common/elf.c  Sun May 21 09:55:15 2006 +0100
@@ -103,10 +103,18 @@ int parseelfimage(struct domain_setup_in
             kernend = vaddr + phdr->p_memsz;
     }
 
-    if ( virt_base )
-        dsi->v_start = virt_base;
-    else
+    dsi->v_start = virt_base;
+    if ( dsi->v_start == 0 )
+    {
+        /*
+         * Legacy compatibility and images with no __xen_guest section:
+         * assume header addresses are virtual addresses, and that 
+         * guest memory should be mapped starting at kernel load address.
+         */
         dsi->v_start = kernstart;
+        if ( dsi->elf_paddr_offset == 0 )
+            dsi->elf_paddr_offset = dsi->v_start;
+    }
 
     dsi->v_kernentry = ehdr->e_entry;
     if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL )

_______________________________________________
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®.