ia64/xen-unstable
changeset 19135:deab3a069185
x86: Better bzimage_headroom() crash fix.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Jan 30 11:04:24 2009 +0000 (2009-01-30) |
parents | 5848b49b74fc |
children | 4a2f93fb03eb |
files | xen/arch/x86/setup.c |
line diff
1.1 --- a/xen/arch/x86/setup.c Fri Jan 30 11:03:28 2009 +0000 1.2 +++ b/xen/arch/x86/setup.c Fri Jan 30 11:04:24 2009 +0000 1.3 @@ -417,7 +417,7 @@ void __init __start_xen(unsigned long mb 1.4 unsigned int initrdidx = 1; 1.5 multiboot_info_t *mbi = __va(mbi_p); 1.6 module_t *mod = (module_t *)__va(mbi->mods_addr); 1.7 - unsigned long nr_pages, modules_length, modules_headroom = -1; 1.8 + unsigned long nr_pages, modules_length, modules_headroom; 1.9 unsigned long allocator_bitmap_end; 1.10 int i, e820_warn = 0, bytes = 0; 1.11 struct ns16550_defaults ns16550 = { 1.12 @@ -618,6 +618,12 @@ void __init __start_xen(unsigned long mb 1.13 */ 1.14 modules_length = mod[mbi->mods_count-1].mod_end - mod[0].mod_start; 1.15 1.16 + /* ensure mod[0] is mapped before parsing */ 1.17 + bootstrap_map(mod[0].mod_start, mod[0].mod_end); 1.18 + modules_headroom = bzimage_headroom( 1.19 + (char *)(unsigned long)mod[0].mod_start, 1.20 + (unsigned long)(mod[0].mod_end - mod[0].mod_start)); 1.21 + 1.22 for ( i = boot_e820.nr_map-1; i >= 0; i-- ) 1.23 { 1.24 uint64_t s, e, mask = (1UL << L2_PAGETABLE_SHIFT) - 1; 1.25 @@ -721,11 +727,6 @@ void __init __start_xen(unsigned long mb 1.26 } 1.27 #endif 1.28 1.29 - if ( modules_headroom == -1 ) 1.30 - modules_headroom = bzimage_headroom( 1.31 - (char *)(unsigned long)mod[0].mod_start, 1.32 - (unsigned long)(mod[0].mod_end - mod[0].mod_start)); 1.33 - 1.34 /* Is the region suitable for relocating the multiboot modules? */ 1.35 if ( !initial_images_start && (s < e) && 1.36 ((e-s) >= (modules_length+modules_headroom)) )