[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Relocate Multiboot module command-line strings.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1233754037 0
# Node ID faf20eb0b69e338668ecbb9f4714b70eba841ce6
# Parent  7a3124098155e710147420047538dc2ef785633d
x86: Relocate Multiboot module command-line strings.

Missed this in the original patch.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/boot/reloc.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff -r 7a3124098155 -r faf20eb0b69e xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c Wed Feb 04 12:43:11 2009 +0000
+++ b/xen/arch/x86/boot/reloc.c Wed Feb 04 13:27:17 2009 +0000
@@ -48,22 +48,31 @@ static void *reloc_mbi_struct(void *old,
     return memcpy(alloc, old, bytes);
 }
 
+static char *reloc_mbi_string(char *old)
+{
+    char *p;
+    for ( p = old; *p != '\0'; p++ )
+        continue;
+    return reloc_mbi_struct(old, p - old + 1);
+}
+
 multiboot_info_t *reloc(multiboot_info_t *mbi_old)
 {
     multiboot_info_t *mbi = reloc_mbi_struct(mbi_old, sizeof(*mbi));
+    int i;
 
     if ( mbi->flags & MBI_CMDLINE )
-    {
-        char *cmdline_old, *p;
-        cmdline_old = (char *)mbi->cmdline;
-        for ( p = cmdline_old; *p != '\0'; p++ )
-            continue;
-        mbi->cmdline = (u32)reloc_mbi_struct(cmdline_old, p - cmdline_old + 1);
-    }
+        mbi->cmdline = (u32)reloc_mbi_string((char *)mbi->cmdline);
 
     if ( mbi->flags & MBI_MODULES )
-        mbi->mods_addr = (u32)reloc_mbi_struct(
+    {
+        module_t *mods = reloc_mbi_struct(
             (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
+        mbi->mods_addr = (u32)mods;
+        for ( i = 0; i < mbi->mods_count; i++ )
+            if ( mods[i].string )
+                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
+    }
 
     if ( mbi->flags & MBI_MEMMAP )
         mbi->mmap_addr = (u32)reloc_mbi_struct(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.