ia64/xen-unstable

changeset 15077:e19ddfa781c5

xen: Some cleanups for x86 start of day.
1. Remove erroneous modification to e820.c
2. Make sure Xen is relocated as high as possible below 4GB.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu May 10 22:54:43 2007 +0100 (2007-05-10)
parents 16319e70f77d
children 60240a72e2b2
files xen/arch/x86/e820.c xen/arch/x86/setup.c
line diff
     1.1 --- a/xen/arch/x86/e820.c	Thu May 10 19:35:25 2007 +0100
     1.2 +++ b/xen/arch/x86/e820.c	Thu May 10 22:54:43 2007 +0100
     1.3 @@ -32,7 +32,7 @@ static void __init add_memory_region(uns
     1.4      }
     1.5  } /* add_memory_region */
     1.6  
     1.7 -/*static*/ void __init print_e820_memory_map(struct e820entry *map, int entries)
     1.8 +static void __init print_e820_memory_map(struct e820entry *map, int entries)
     1.9  {
    1.10      int i;
    1.11  
     2.1 --- a/xen/arch/x86/setup.c	Thu May 10 19:35:25 2007 +0100
     2.2 +++ b/xen/arch/x86/setup.c	Thu May 10 22:54:43 2007 +0100
     2.3 @@ -462,7 +462,7 @@ void __init __start_xen(multiboot_info_t
     2.4      }
     2.5  
     2.6      /*
     2.7 -     * Iterate over all superpage-aligned RAM regions.
     2.8 +     * Iterate backwards over all superpage-aligned RAM regions.
     2.9       * 
    2.10       * We require superpage alignment because the boot allocator is not yet
    2.11       * initialised. Hence we can only map superpages in the address range
    2.12 @@ -475,7 +475,7 @@ void __init __start_xen(multiboot_info_t
    2.13       * x86/64, we relocate Xen to higher memory.
    2.14       */
    2.15      modules_length = mod[mbi->mods_count-1].mod_end - mod[0].mod_start;
    2.16 -    for ( i = 0; i < boot_e820.nr_map; i++ )
    2.17 +    for ( i = boot_e820.nr_map-1; i >= 0; i-- )
    2.18      {
    2.19          uint64_t s, e, mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
    2.20  
    2.21 @@ -491,19 +491,6 @@ void __init __start_xen(multiboot_info_t
    2.22              (unsigned long)maddr_to_bootstrap_virt(s),
    2.23              s >> PAGE_SHIFT, (e-s) >> PAGE_SHIFT, PAGE_HYPERVISOR);
    2.24  
    2.25 -        /* Is the region suitable for relocating the multiboot modules? */
    2.26 -        if ( !initial_images_start && ((e-s) >= modules_length) )
    2.27 -        {
    2.28 -            e -= modules_length;
    2.29 -            e &= ~mask;
    2.30 -            initial_images_start = e;
    2.31 -            initial_images_end = initial_images_start + modules_length;
    2.32 -            move_memory(initial_images_start, 
    2.33 -                        mod[0].mod_start, mod[mbi->mods_count-1].mod_end);
    2.34 -            if ( s >= e )
    2.35 -                continue;
    2.36 -        }
    2.37 -
    2.38  #if defined(CONFIG_X86_64)
    2.39          /* Is the region suitable for relocating Xen? */
    2.40          if ( !xen_phys_start && (((e-s) >> 20) >= opt_xenheap_megabytes) )
    2.41 @@ -571,6 +558,16 @@ void __init __start_xen(multiboot_info_t
    2.42                  "D" (__va(__pa(cpu0_stack))), "c" (STACK_SIZE) : "memory" );
    2.43          }
    2.44  #endif
    2.45 +
    2.46 +        /* Is the region suitable for relocating the multiboot modules? */
    2.47 +        if ( !initial_images_start && (s < e) && ((e-s) >= modules_length) )
    2.48 +        {
    2.49 +            e -= modules_length;
    2.50 +            initial_images_start = e;
    2.51 +            initial_images_end = initial_images_start + modules_length;
    2.52 +            move_memory(initial_images_start, 
    2.53 +                        mod[0].mod_start, mod[mbi->mods_count-1].mod_end);
    2.54 +        }
    2.55      }
    2.56  
    2.57      if ( !initial_images_start )