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

[Xen-changelog] [xen-unstable] x86: physaddr_bitsize must always be initialised for 32-on-64 dom0.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202390415 0
# Node ID eef22fa42f44cf4f8d971a37dd265fc56eb35417
# Parent  9cac8f659a24bc1cfd4d94490c65f49aa3ac361b
x86: physaddr_bitsize must always be initialised for 32-on-64 dom0.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/domain_build.c |   44 ++++++++++++++++++--------------------------
 1 files changed, 18 insertions(+), 26 deletions(-)

diff -r 9cac8f659a24 -r eef22fa42f44 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Thu Feb 07 13:19:19 2008 +0000
+++ b/xen/arch/x86/domain_build.c       Thu Feb 07 13:20:15 2008 +0000
@@ -292,9 +292,6 @@ int __init construct_dom0(
             compatible = 1;
         break;
     case 4: /* x86_64 */
-#ifndef CONFIG_COMPAT
-        printk(" Xen  kernel: 64-bit, lsb\n");
-#else
         printk(" Xen  kernel: 64-bit, lsb, compat32\n");
         if (elf_32bit(&elf) && parms.pae == PAEKERN_bimodal)
             parms.pae = PAEKERN_extended_cr3;
@@ -303,7 +300,6 @@ int __init construct_dom0(
             compat32 = 1;
             compatible = 1;
         }
-#endif
         if (elf_64bit(&elf) && machine == EM_X86_64)
             compatible = 1;
         break;
@@ -323,7 +319,7 @@ int __init construct_dom0(
         return -EINVAL;
     }
 
-#ifdef CONFIG_COMPAT
+#if defined(__x86_64__)
     if ( compat32 )
     {
         l1_pgentry_t gdt_l1e;
@@ -346,34 +342,32 @@ int __init construct_dom0(
         flush_tlb_one_local(GDT_LDT_VIRT_START + FIRST_RESERVED_GDT_BYTE);
     }
 #endif
+
     if ( parms.pae == PAEKERN_extended_cr3 )
             set_bit(VMASST_TYPE_pae_extended_cr3, &d->vm_assist);
 
-    if ( UNSET_ADDR != parms.virt_hv_start_low && elf_32bit(&elf) )
-    {
-#if CONFIG_PAGING_LEVELS < 4
+    if ( (parms.virt_hv_start_low != UNSET_ADDR) && elf_32bit(&elf) )
+    {
         unsigned long mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
+        value = (parms.virt_hv_start_low + mask) & ~mask;
+        BUG_ON(!is_pv_32bit_domain(d));
+#if defined(__i386__)
+        if ( value > HYPERVISOR_VIRT_START )
+            panic("Domain 0 expects too high a hypervisor start address.\n");
 #else
-        unsigned long mask = is_pv_32bit_domain(d)
-                             ? (1UL << L2_PAGETABLE_SHIFT) - 1
-                             : (1UL << L4_PAGETABLE_SHIFT) - 1;
-#endif
-
-        value = (parms.virt_hv_start_low + mask) & ~mask;
-#ifdef CONFIG_COMPAT
+        if ( value > __HYPERVISOR_COMPAT_VIRT_START )
+            panic("Domain 0 expects too high a hypervisor start address.\n");
         HYPERVISOR_COMPAT_VIRT_START(d) =
             max_t(unsigned int, m2p_compat_vstart, value);
+#endif
+    }
+
+#if defined(__x86_64__)
+    if ( is_pv_32on64_domain(d) )
         d->arch.physaddr_bitsize =
             fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
             + (PAGE_SIZE - 2);
-        if ( value > (!is_pv_32on64_domain(d) ?
-                      HYPERVISOR_VIRT_START :
-                      __HYPERVISOR_COMPAT_VIRT_START) )
-#else
-        if ( value > HYPERVISOR_VIRT_START )
-#endif
-            panic("Domain 0 expects too high a hypervisor start address.\n");
-    }
+#endif
 
     /*
      * Why do we need this? The number of page-table frames depends on the 
@@ -702,7 +696,6 @@ int __init construct_dom0(
         mfn++;
     }
 
-#ifdef CONFIG_COMPAT
     if ( is_pv_32on64_domain(d) )
     {
         /* Ensure the first four L3 entries are all populated. */
@@ -724,7 +717,6 @@ int __init construct_dom0(
                
&compat_idle_pg_table_l2[l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
                COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*l2tab));
     }
-#endif
 
     /* Pages that are part of page tables must be read only. */
     l4tab = l4start + l4_table_offset(vpt_start);
@@ -885,7 +877,7 @@ int __init construct_dom0(
         si->console.dom0.info_size = sizeof(struct dom0_vga_console_info);
     }
 
-#ifdef CONFIG_COMPAT
+#if defined(__x86_64__)
     if ( is_pv_32on64_domain(d) )
         xlat_start_info(si, XLAT_start_info_console_dom0);
 #endif

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