ia64/xen-unstable

changeset 10122:4dcb93547710

[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@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun May 21 09:55:15 2006 +0100 (2006-05-21)
parents d081a485f34b
children d9f63f9361c4
files tools/libxc/xc_load_elf.c xen/common/elf.c
line diff
     1.1 --- a/tools/libxc/xc_load_elf.c	Sat May 20 16:25:28 2006 +0100
     1.2 +++ b/tools/libxc/xc_load_elf.c	Sun May 21 09:55:15 2006 +0100
     1.3 @@ -148,14 +148,9 @@ static int parseelfimage(const char *ima
     1.4  
     1.5      dsi->xen_guest_string = guestinfo;
     1.6  
     1.7 -    if ( (p = strstr(guestinfo, "VIRT_BASE=")) == NULL )
     1.8 -    {
     1.9 -        ERROR("Malformed ELF image. No VIRT_BASE specified");
    1.10 -        return -EINVAL;
    1.11 -    }
    1.12 -
    1.13 -    virt_base = strtoul(p+10, &p, 0);
    1.14 -
    1.15 +    virt_base = 0;
    1.16 +    if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL )
    1.17 +        virt_base = strtoul(p+10, &p, 0);
    1.18      dsi->elf_paddr_offset = virt_base;
    1.19      if ( (p = strstr(guestinfo, "ELF_PADDR_OFFSET=")) != NULL )
    1.20          dsi->elf_paddr_offset = strtoul(p+17, &p, 0);
    1.21 @@ -172,10 +167,18 @@ static int parseelfimage(const char *ima
    1.22              kernend = vaddr + phdr->p_memsz;
    1.23      }
    1.24  
    1.25 -    if ( virt_base )
    1.26 -        dsi->v_start = virt_base;
    1.27 -    else
    1.28 +    dsi->v_start = virt_base;
    1.29 +    if ( dsi->v_start == 0 )
    1.30 +    {
    1.31 +        /*
    1.32 +         * Legacy compatibility and images with no __xen_guest section:
    1.33 +         * assume header addresses are virtual addresses, and that 
    1.34 +         * guest memory should be mapped starting at kernel load address.
    1.35 +         */
    1.36          dsi->v_start = kernstart;
    1.37 +        if ( dsi->elf_paddr_offset == 0 )
    1.38 +            dsi->elf_paddr_offset = dsi->v_start;
    1.39 +    }
    1.40  
    1.41      dsi->v_kernentry = ehdr->e_entry;
    1.42      if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL )
     2.1 --- a/xen/common/elf.c	Sat May 20 16:25:28 2006 +0100
     2.2 +++ b/xen/common/elf.c	Sun May 21 09:55:15 2006 +0100
     2.3 @@ -103,10 +103,18 @@ int parseelfimage(struct domain_setup_in
     2.4              kernend = vaddr + phdr->p_memsz;
     2.5      }
     2.6  
     2.7 -    if ( virt_base )
     2.8 -        dsi->v_start = virt_base;
     2.9 -    else
    2.10 +    dsi->v_start = virt_base;
    2.11 +    if ( dsi->v_start == 0 )
    2.12 +    {
    2.13 +        /*
    2.14 +         * Legacy compatibility and images with no __xen_guest section:
    2.15 +         * assume header addresses are virtual addresses, and that 
    2.16 +         * guest memory should be mapped starting at kernel load address.
    2.17 +         */
    2.18          dsi->v_start = kernstart;
    2.19 +        if ( dsi->elf_paddr_offset == 0 )
    2.20 +            dsi->elf_paddr_offset = dsi->v_start;
    2.21 +    }
    2.22  
    2.23      dsi->v_kernentry = ehdr->e_entry;
    2.24      if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL )