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

[Xen-devel] [PATCH for-xen-4.5 v3 05/16] x86/efi: Add place_string_u32() function



Add place_string_u32() function and rename place_string()
to place_string_char().

Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
---
 xen/arch/x86/efi/efi-boot.h |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 4348cfe..71030b0 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -103,14 +103,14 @@ static void __init relocate_trampoline(unsigned long phys)
         *(u16 *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4;
 }
 
-static void __init place_string(u32 *addr, const char *s)
+static void __init place_string_char(char **addr, const char *s)
 {
     static char *__initdata alloc = start;
 
     if ( s && *s )
     {
         size_t len1 = strlen(s) + 1;
-        const char *old = (char *)(long)*addr;
+        const char *old = *addr;
         size_t len2 = *addr ? strlen(old) + 1 : 0;
 
         alloc -= len1 + len2;
@@ -126,7 +126,16 @@ static void __init place_string(u32 *addr, const char *s)
             memcpy(alloc + len1, old, len2);
         }
     }
-    *addr = (long)alloc;
+    *addr = alloc;
+}
+
+static void __init place_string_u32(u32 *addr, const char *s)
+{
+    char *s_new = (char *)(long)*addr;
+
+    place_string_char(&s_new, s);
+
+    *addr = (long)s_new;
 }
 
 static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable,
@@ -192,7 +201,7 @@ static void __init 
efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable,
 
 static void *__init efi_arch_allocate_mmap_buffer(UINTN map_size)
 {
-    place_string(&mbi.mem_upper, NULL);
+    place_string_u32(&mbi.mem_upper, NULL);
     mbi.mem_upper -= map_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
@@ -280,10 +289,10 @@ static void __init efi_arch_handle_cmdline(CHAR16 
*image_name,
     {
         name.w = cmdline_options;
         w2s(&name);
-        place_string(&mbi.cmdline, name.s);
+        place_string_u32(&mbi.cmdline, name.s);
     }
     if ( cfgfile_options )
-        place_string(&mbi.cmdline, cfgfile_options);
+        place_string_u32(&mbi.cmdline, cfgfile_options);
     /* Insert image name last, as it gets prefixed to the other options. */
     if ( image_name )
     {
@@ -292,7 +301,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 
*image_name,
     }
     else
         name.s = "xen";
-    place_string(&mbi.cmdline, name.s);
+    place_string_u32(&mbi.cmdline, name.s);
 
     if ( mbi.cmdline )
         mbi.flags |= MBI_CMDLINE;
@@ -587,12 +596,12 @@ static void __init efi_arch_handle_module(struct file 
*file, const CHAR16 *name,
     /*
      * If options are provided, put them in
      * mb_modules[mbi.mods_count].string after the filename, with a space
-     * separating them.  place_string() prepends strings and adds separating
+     * separating them.  place_string_u32() prepends strings and adds 
separating
      * spaces, so the call order is reversed.
      */
     if ( options )
-        place_string(&mb_modules[mbi.mods_count].string, options);
-    place_string(&mb_modules[mbi.mods_count].string, local_name.s);
+        place_string_u32(&mb_modules[mbi.mods_count].string, options);
+    place_string_u32(&mb_modules[mbi.mods_count].string, local_name.s);
     mb_modules[mbi.mods_count].mod_start = file->addr >> PAGE_SHIFT;
     mb_modules[mbi.mods_count].mod_end = file->size;
     ++mbi.mods_count;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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