ia64/xen-unstable

changeset 17003:eef22fa42f44

x86: physaddr_bitsize must always be initialised for 32-on-64 dom0.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 07 13:20:15 2008 +0000 (2008-02-07)
parents 9cac8f659a24
children e6cf98edf0c5
files xen/arch/x86/domain_build.c
line diff
     1.1 --- a/xen/arch/x86/domain_build.c	Thu Feb 07 13:19:19 2008 +0000
     1.2 +++ b/xen/arch/x86/domain_build.c	Thu Feb 07 13:20:15 2008 +0000
     1.3 @@ -292,9 +292,6 @@ int __init construct_dom0(
     1.4              compatible = 1;
     1.5          break;
     1.6      case 4: /* x86_64 */
     1.7 -#ifndef CONFIG_COMPAT
     1.8 -        printk(" Xen  kernel: 64-bit, lsb\n");
     1.9 -#else
    1.10          printk(" Xen  kernel: 64-bit, lsb, compat32\n");
    1.11          if (elf_32bit(&elf) && parms.pae == PAEKERN_bimodal)
    1.12              parms.pae = PAEKERN_extended_cr3;
    1.13 @@ -303,7 +300,6 @@ int __init construct_dom0(
    1.14              compat32 = 1;
    1.15              compatible = 1;
    1.16          }
    1.17 -#endif
    1.18          if (elf_64bit(&elf) && machine == EM_X86_64)
    1.19              compatible = 1;
    1.20          break;
    1.21 @@ -323,7 +319,7 @@ int __init construct_dom0(
    1.22          return -EINVAL;
    1.23      }
    1.24  
    1.25 -#ifdef CONFIG_COMPAT
    1.26 +#if defined(__x86_64__)
    1.27      if ( compat32 )
    1.28      {
    1.29          l1_pgentry_t gdt_l1e;
    1.30 @@ -346,34 +342,32 @@ int __init construct_dom0(
    1.31          flush_tlb_one_local(GDT_LDT_VIRT_START + FIRST_RESERVED_GDT_BYTE);
    1.32      }
    1.33  #endif
    1.34 +
    1.35      if ( parms.pae == PAEKERN_extended_cr3 )
    1.36              set_bit(VMASST_TYPE_pae_extended_cr3, &d->vm_assist);
    1.37  
    1.38 -    if ( UNSET_ADDR != parms.virt_hv_start_low && elf_32bit(&elf) )
    1.39 +    if ( (parms.virt_hv_start_low != UNSET_ADDR) && elf_32bit(&elf) )
    1.40      {
    1.41 -#if CONFIG_PAGING_LEVELS < 4
    1.42          unsigned long mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
    1.43 +        value = (parms.virt_hv_start_low + mask) & ~mask;
    1.44 +        BUG_ON(!is_pv_32bit_domain(d));
    1.45 +#if defined(__i386__)
    1.46 +        if ( value > HYPERVISOR_VIRT_START )
    1.47 +            panic("Domain 0 expects too high a hypervisor start address.\n");
    1.48  #else
    1.49 -        unsigned long mask = is_pv_32bit_domain(d)
    1.50 -                             ? (1UL << L2_PAGETABLE_SHIFT) - 1
    1.51 -                             : (1UL << L4_PAGETABLE_SHIFT) - 1;
    1.52 -#endif
    1.53 -
    1.54 -        value = (parms.virt_hv_start_low + mask) & ~mask;
    1.55 -#ifdef CONFIG_COMPAT
    1.56 +        if ( value > __HYPERVISOR_COMPAT_VIRT_START )
    1.57 +            panic("Domain 0 expects too high a hypervisor start address.\n");
    1.58          HYPERVISOR_COMPAT_VIRT_START(d) =
    1.59              max_t(unsigned int, m2p_compat_vstart, value);
    1.60 +#endif
    1.61 +    }
    1.62 +
    1.63 +#if defined(__x86_64__)
    1.64 +    if ( is_pv_32on64_domain(d) )
    1.65          d->arch.physaddr_bitsize =
    1.66              fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
    1.67              + (PAGE_SIZE - 2);
    1.68 -        if ( value > (!is_pv_32on64_domain(d) ?
    1.69 -                      HYPERVISOR_VIRT_START :
    1.70 -                      __HYPERVISOR_COMPAT_VIRT_START) )
    1.71 -#else
    1.72 -        if ( value > HYPERVISOR_VIRT_START )
    1.73  #endif
    1.74 -            panic("Domain 0 expects too high a hypervisor start address.\n");
    1.75 -    }
    1.76  
    1.77      /*
    1.78       * Why do we need this? The number of page-table frames depends on the 
    1.79 @@ -702,7 +696,6 @@ int __init construct_dom0(
    1.80          mfn++;
    1.81      }
    1.82  
    1.83 -#ifdef CONFIG_COMPAT
    1.84      if ( is_pv_32on64_domain(d) )
    1.85      {
    1.86          /* Ensure the first four L3 entries are all populated. */
    1.87 @@ -724,7 +717,6 @@ int __init construct_dom0(
    1.88                 &compat_idle_pg_table_l2[l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
    1.89                 COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*l2tab));
    1.90      }
    1.91 -#endif
    1.92  
    1.93      /* Pages that are part of page tables must be read only. */
    1.94      l4tab = l4start + l4_table_offset(vpt_start);
    1.95 @@ -885,7 +877,7 @@ int __init construct_dom0(
    1.96          si->console.dom0.info_size = sizeof(struct dom0_vga_console_info);
    1.97      }
    1.98  
    1.99 -#ifdef CONFIG_COMPAT
   1.100 +#if defined(__x86_64__)
   1.101      if ( is_pv_32on64_domain(d) )
   1.102          xlat_start_info(si, XLAT_start_info_console_dom0);
   1.103  #endif