ia64/xen-unstable

changeset 5371:d29fe2289a59

bitkeeper revision 1.1691.1.6 (42a6b81aGnsCnSz81D0LDCSasR3Jyw)

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@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jun 08 09:19:22 2005 +0000 (2005-06-08)
parents 5f9a0c66f74b
children bf014cae2dad
files xen/arch/ia64/domain.c xen/arch/x86/domain_build.c xen/common/elf.c xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/ia64/domain.c	Wed Jun 08 09:04:58 2005 +0000
     1.2 +++ b/xen/arch/ia64/domain.c	Wed Jun 08 09:19:22 2005 +0000
     1.3 @@ -823,14 +823,14 @@ int construct_dom0(struct domain *d,
     1.4  
     1.5      /* Temp workaround */
     1.6      if (running_on_sim)
     1.7 -	dsi.xen_elf_image = 1;
     1.8 +	dsi.xen_section_string = (char *)1;
     1.9  
    1.10 -    if ((!vmx_enabled) && !dsi.xen_elf_image) {
    1.11 +    if ((!vmx_enabled) && !dsi.xen_section_string) {
    1.12  	printk("Lack of hardware support for unmodified vmx dom0\n");
    1.13  	panic("");
    1.14      }
    1.15  
    1.16 -    if (vmx_enabled && !dsi.xen_elf_image) {
    1.17 +    if (vmx_enabled && !dsi.xen_section_string) {
    1.18  	printk("Dom0 is vmx domain!\n");
    1.19  	vmx_dom0 = 1;
    1.20      }
     2.1 --- a/xen/arch/x86/domain_build.c	Wed Jun 08 09:04:58 2005 +0000
     2.2 +++ b/xen/arch/x86/domain_build.c	Wed Jun 08 09:19:22 2005 +0000
     2.3 @@ -74,7 +74,7 @@ int construct_dom0(struct domain *d,
     2.4                     unsigned long _initrd_start, unsigned long initrd_len,
     2.5                     char *cmdline)
     2.6  {
     2.7 -    int i, rc;
     2.8 +    int i, rc, dom0_pae, xen_pae;
     2.9      unsigned long pfn, mfn;
    2.10      unsigned long nr_pages;
    2.11      unsigned long nr_pt_pages;
    2.12 @@ -122,7 +122,8 @@ int construct_dom0(struct domain *d,
    2.13      unsigned long mpt_alloc;
    2.14  
    2.15      extern void physdev_init_dom0(struct domain *);
    2.16 -    extern void translate_l2pgtable(struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
    2.17 +    extern void translate_l2pgtable(
    2.18 +        struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
    2.19  
    2.20      /* Sanity! */
    2.21      if ( d->domain_id != 0 ) 
    2.22 @@ -150,6 +151,21 @@ int construct_dom0(struct domain *d,
    2.23      if ( (rc = parseelfimage(&dsi)) != 0 )
    2.24          return rc;
    2.25  
    2.26 +    if ( dsi.xen_section_string == NULL )
    2.27 +    {
    2.28 +        printk("Not a Xen-ELF image: '__xen_guest' section not found.\n");
    2.29 +        return -EINVAL;
    2.30 +    }
    2.31 +
    2.32 +    dom0_pae = !!strstr(dsi.xen_section_string, "PAE=yes");
    2.33 +    xen_pae  = (CONFIG_PAGING_LEVELS == 3);
    2.34 +    if ( dom0_pae != xen_pae )
    2.35 +    {
    2.36 +        printk("PAE mode mismatch between Xen and DOM0 (xen=%s, dom0=%s)\n",
    2.37 +               xen_pae ? "yes" : "no", dom0_pae ? "yes" : "no");
    2.38 +        return -EINVAL;
    2.39 +    }
    2.40 +
    2.41      /* Align load address to 4MB boundary. */
    2.42      dsi.v_start &= ~((1UL<<22)-1);
    2.43  
     3.1 --- a/xen/common/elf.c	Wed Jun 08 09:04:58 2005 +0000
     3.2 +++ b/xen/common/elf.c	Wed Jun 08 09:19:22 2005 +0000
     3.3 @@ -11,12 +11,6 @@
     3.4  #include <xen/elf.h>
     3.5  #include <xen/sched.h>
     3.6  
     3.7 -#ifdef CONFIG_X86
     3.8 -#define FORCE_XENELF_IMAGE 1
     3.9 -#elif defined(__ia64__)
    3.10 -#define FORCE_XENELF_IMAGE 0
    3.11 -#endif
    3.12 -
    3.13  static void loadelfsymtab(struct domain_setup_info *dsi, int doload);
    3.14  static inline int is_loadable_phdr(Elf_Phdr *phdr)
    3.15  {
    3.16 @@ -85,16 +79,8 @@ int parseelfimage(struct domain_setup_in
    3.17  
    3.18          break;
    3.19      }
    3.20 -    if ( guestinfo == NULL )
    3.21 -    {
    3.22 -        printk("Not a Xen-ELF image: '__xen_guest' section not found.\n");
    3.23 -	dsi->xen_elf_image = 0;
    3.24 -#if FORCE_XENELF_IMAGE
    3.25 -        return -EINVAL;
    3.26 -#endif
    3.27 -    } else {
    3.28 -	dsi->xen_elf_image = 1;
    3.29 -    }
    3.30 +
    3.31 +    dsi->xen_section_string = guestinfo;
    3.32  
    3.33      for ( h = 0; h < ehdr->e_phnum; h++ ) 
    3.34      {
     4.1 --- a/xen/include/xen/sched.h	Wed Jun 08 09:04:58 2005 +0000
     4.2 +++ b/xen/include/xen/sched.h	Wed Jun 08 09:19:22 2005 +0000
     4.3 @@ -155,7 +155,7 @@ struct domain_setup_info
     4.4      unsigned long symtab_addr;
     4.5      unsigned long symtab_len;
     4.6      /* Indicate whether it's xen specific image */
     4.7 -    unsigned int xen_elf_image;
     4.8 +    char *xen_section_string;
     4.9  };
    4.10  
    4.11  extern struct domain idle0_domain;