x86: Correctly allocate module-relocation area and bzimage headroom.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Dec 2009 14:19:28 +0000 (14:19 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Dec 2009 14:19:28 +0000 (14:19 +0000)
Without this patch, loading a bzimage dom0 kernel while also
requesting a dynamically-allocated crashkernel area is broken.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/setup.c

index 98249807bc933e0780b7bb171a89022e90d00135..d1745ba94d641615765e3e8266446b09d86692d0 100644 (file)
@@ -762,11 +762,9 @@ void __init __start_xen(unsigned long mbi_p)
              ((e-s) >= (modules_length+modules_headroom)) )
         {
             initial_images_end = e;
-            e = (e - modules_length) & PAGE_MASK;
-            initial_images_start = e;
-            e -= modules_headroom;
-            initial_images_base = e;
-            e += modules_length + modules_headroom;
+            initial_images_start = initial_images_end - modules_length;
+            initial_images_base = initial_images_start - modules_headroom;
+            initial_images_base &= PAGE_MASK;
             for ( j = mbi->mods_count-1; j >= 0; j-- )
             {
                 e -= mod[j].mod_end - mod[j].mod_start;
@@ -774,6 +772,7 @@ void __init __start_xen(unsigned long mbi_p)
                 mod[j].mod_end += e - mod[j].mod_start;
                 mod[j].mod_start = e;
             }
+            e = initial_images_base;
         }
 
         if ( !kexec_crash_area.start && (s < e) &&