ia64/xen-unstable

changeset 19160:faf20eb0b69e

x86: Relocate Multiboot module command-line strings.

Missed this in the original patch.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 04 13:27:17 2009 +0000 (2009-02-04)
parents 7a3124098155
children 398291c661b3
files xen/arch/x86/boot/reloc.c
line diff
     1.1 --- a/xen/arch/x86/boot/reloc.c	Wed Feb 04 12:43:11 2009 +0000
     1.2 +++ b/xen/arch/x86/boot/reloc.c	Wed Feb 04 13:27:17 2009 +0000
     1.3 @@ -48,22 +48,31 @@ static void *reloc_mbi_struct(void *old,
     1.4      return memcpy(alloc, old, bytes);
     1.5  }
     1.6  
     1.7 +static char *reloc_mbi_string(char *old)
     1.8 +{
     1.9 +    char *p;
    1.10 +    for ( p = old; *p != '\0'; p++ )
    1.11 +        continue;
    1.12 +    return reloc_mbi_struct(old, p - old + 1);
    1.13 +}
    1.14 +
    1.15  multiboot_info_t *reloc(multiboot_info_t *mbi_old)
    1.16  {
    1.17      multiboot_info_t *mbi = reloc_mbi_struct(mbi_old, sizeof(*mbi));
    1.18 +    int i;
    1.19  
    1.20      if ( mbi->flags & MBI_CMDLINE )
    1.21 -    {
    1.22 -        char *cmdline_old, *p;
    1.23 -        cmdline_old = (char *)mbi->cmdline;
    1.24 -        for ( p = cmdline_old; *p != '\0'; p++ )
    1.25 -            continue;
    1.26 -        mbi->cmdline = (u32)reloc_mbi_struct(cmdline_old, p - cmdline_old + 1);
    1.27 -    }
    1.28 +        mbi->cmdline = (u32)reloc_mbi_string((char *)mbi->cmdline);
    1.29  
    1.30      if ( mbi->flags & MBI_MODULES )
    1.31 -        mbi->mods_addr = (u32)reloc_mbi_struct(
    1.32 +    {
    1.33 +        module_t *mods = reloc_mbi_struct(
    1.34              (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
    1.35 +        mbi->mods_addr = (u32)mods;
    1.36 +        for ( i = 0; i < mbi->mods_count; i++ )
    1.37 +            if ( mods[i].string )
    1.38 +                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
    1.39 +    }
    1.40  
    1.41      if ( mbi->flags & MBI_MEMMAP )
    1.42          mbi->mmap_addr = (u32)reloc_mbi_struct(