debuggers.hg
changeset 21097:bcc09eb7379f
x86_32: Relocate multiboot modules to below 1GB.
Otherwise Xen cannot access them later during boot. GRUB2 places
modules as high as possible below 4GB, which has been causing boot
failure.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Otherwise Xen cannot access them later during boot. GRUB2 places
modules as high as possible below 4GB, which has been causing boot
failure.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Mar 23 07:28:33 2010 +0000 (2010-03-23) |
parents | ab5f65e8137c |
children | dbe65678b6f8 |
files | xen/arch/x86/boot/Makefile xen/arch/x86/boot/build32.mk xen/arch/x86/boot/reloc.c |
line diff
1.1 --- a/xen/arch/x86/boot/Makefile Mon Mar 22 10:29:42 2010 +0000 1.2 +++ b/xen/arch/x86/boot/Makefile Tue Mar 23 07:28:33 2010 +0000 1.3 @@ -4,6 +4,6 @@ head.o: reloc.S 1.4 1.5 BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\+BOOT_TRAMPOLINE[[:space:]]\+,,p' $(BASEDIR)/include/asm-x86/config.h) 1.6 %.S: %.c 1.7 - RELOC=$(BOOT_TRAMPOLINE) $(MAKE) -f build32.mk $@ 1.8 + RELOC=$(BOOT_TRAMPOLINE) XEN_BITSPERLONG=$(patsubst x86_%,%,$(TARGET_SUBARCH)) $(MAKE) -f build32.mk $@ 1.9 1.10 reloc.S: $(BASEDIR)/include/asm-x86/config.h
2.1 --- a/xen/arch/x86/boot/build32.mk Mon Mar 22 10:29:42 2010 +0000 2.2 +++ b/xen/arch/x86/boot/build32.mk Tue Mar 23 07:28:33 2010 +0000 2.3 @@ -22,6 +22,6 @@ CFLAGS += -Werror -fno-builtin -msoft-fl 2.4 $(LD) $(LDFLAGS_DIRECT) -N -Ttext $(RELOC) -o $@ $< 2.5 2.6 %.o: %.c 2.7 - $(CC) $(CFLAGS) -c $< -o $@ 2.8 + $(CC) $(CFLAGS) -DXEN_BITSPERLONG=$(XEN_BITSPERLONG) -c $< -o $@ 2.9 2.10 reloc.o: $(BASEDIR)/include/asm-x86/config.h
3.1 --- a/xen/arch/x86/boot/reloc.c Mon Mar 22 10:29:42 2010 +0000 3.2 +++ b/xen/arch/x86/boot/reloc.c Tue Mar 23 07:28:33 2010 +0000 3.3 @@ -70,8 +70,28 @@ multiboot_info_t *reloc(multiboot_info_t 3.4 (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t)); 3.5 mbi->mods_addr = (u32)mods; 3.6 for ( i = 0; i < mbi->mods_count; i++ ) 3.7 + { 3.8 +#if XEN_BITSPERLONG == 32 3.9 + /* 3.10 + * 32-bit Xen only maps bottom 1GB of memory at boot time. 3.11 + * Relocate modules which extend beyond this (GRUB2 in particular 3.12 + * likes to place modules as high as possible below 4GB). 3.13 + */ 3.14 +#define BOOTMAP_END (1ul<<30) /* 1GB */ 3.15 + static void *mod_alloc = (void *)BOOTMAP_END; 3.16 + u32 mod_len = mods[i].mod_end - mods[i].mod_start; 3.17 + if ( mods[i].mod_end > BOOTMAP_END ) 3.18 + { 3.19 + mod_alloc = (void *) 3.20 + (((unsigned long)mod_alloc - mod_len) & ~15ul); 3.21 + mods[i].mod_start = (u32)memcpy( 3.22 + mod_alloc, (char *)mods[i].mod_start, mod_len); 3.23 + mods[i].mod_end = mods[i].mod_start + mod_len; 3.24 + } 3.25 +#endif 3.26 if ( mods[i].string ) 3.27 mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string); 3.28 + } 3.29 } 3.30 3.31 if ( mbi->flags & MBI_MEMMAP )