ia64/xen-unstable

changeset 19544:94ffd85005c5

x86: Support discontiguous sets of multiboot modules.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 14 15:23:53 2009 +0100 (2009-04-14)
parents 81d6b5762c40
children 34dca01addc9
files xen/arch/x86/setup.c
line diff
     1.1 --- a/xen/arch/x86/setup.c	Tue Apr 14 14:52:27 2009 +0100
     1.2 +++ b/xen/arch/x86/setup.c	Tue Apr 14 15:23:53 2009 +0100
     1.3 @@ -419,7 +419,7 @@ void __init __start_xen(unsigned long mb
     1.4      multiboot_info_t *mbi = __va(mbi_p);
     1.5      module_t *mod = (module_t *)__va(mbi->mods_addr);
     1.6      unsigned long nr_pages, modules_length, modules_headroom;
     1.7 -    int i, e820_warn = 0, bytes = 0;
     1.8 +    int i, j, e820_warn = 0, bytes = 0;
     1.9      struct ns16550_defaults ns16550 = {
    1.10          .data_bits = 8,
    1.11          .parity    = 'n',
    1.12 @@ -614,7 +614,9 @@ void __init __start_xen(unsigned long mb
    1.13       * we can relocate the dom0 kernel and other multiboot modules. Also, on
    1.14       * x86/64, we relocate Xen to higher memory.
    1.15       */
    1.16 -    modules_length = mod[mbi->mods_count-1].mod_end - mod[0].mod_start;
    1.17 +    modules_length = 0;
    1.18 +    for ( i = 0; i < mbi->mods_count; i++ )
    1.19 +        modules_length += mod[i].mod_end - mod[i].mod_start;
    1.20  
    1.21      /* ensure mod[0] is mapped before parsing */
    1.22      bootstrap_map(mod[0].mod_start, mod[0].mod_end);
    1.23 @@ -735,8 +737,14 @@ void __init __start_xen(unsigned long mb
    1.24              initial_images_start = e;
    1.25              e -= modules_headroom;
    1.26              initial_images_base = e;
    1.27 -            move_memory(initial_images_start,
    1.28 -                        mod[0].mod_start, mod[mbi->mods_count-1].mod_end);
    1.29 +            e += modules_length + modules_headroom;
    1.30 +            for ( j = mbi->mods_count-1; j >= 0; j-- )
    1.31 +            {
    1.32 +                e -= mod[j].mod_end - mod[j].mod_start;
    1.33 +                move_memory(e, mod[j].mod_start, mod[j].mod_end);
    1.34 +                mod[j].mod_end += e - mod[j].mod_start;
    1.35 +                mod[j].mod_start = e;
    1.36 +            }
    1.37          }
    1.38  
    1.39          if ( !kexec_crash_area.start && (s < e) &&
    1.40 @@ -1030,8 +1038,7 @@ void __init __start_xen(unsigned long mb
    1.41  
    1.42      if ( (initrdidx > 0) && (initrdidx < mbi->mods_count) )
    1.43      {
    1.44 -        _initrd_start = initial_images_start +
    1.45 -            (mod[initrdidx].mod_start - mod[0].mod_start);
    1.46 +        _initrd_start = mod[initrdidx].mod_start;
    1.47          _initrd_len   = mod[initrdidx].mod_end - mod[initrdidx].mod_start;
    1.48      }
    1.49