@@ -174,12 +174,19 @@ void __init load_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
++mbi.mods_count;
}
-static void __init split_value(char *s)
+/* Truncate string at first space, and return pointer
+ * to remainder of string.
+ */
+char * __init truncate_string(char *s)
{
- place_string(&mb_modules[mbi.mods_count].string, s);
while ( *s && !isspace(*s) )
++s;
- *s = 0;
+ if (*s)
+ {
+ *s = 0;
+ return(s + 1);
+ }
+ return(NULL);
}
static void __init edd_put_string(u8 *dst, size_t n, const char *src)
@@ -570,7 +577,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
}
if ( !name.s )
blexit(L"No Dom0 kernel image specified.");
- split_value(name.s);
+ place_string(&mb_modules[mbi.mods_count].string, name.s);
+ truncate_string(name.s);
load_file(dir_handle, s2w(&name), &kernel);
efi_bs->FreePool(name.w);
@@ -582,7 +590,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
name.s = get_value(&cfg, section.s, "ramdisk");
if ( name.s )
{
- split_value(name.s);
+ place_string(&mb_modules[mbi.mods_count].string, name.s);
+ truncate_string(name.s);
load_file(dir_handle, s2w(&name), &ramdisk);
efi_bs->FreePool(name.w);
}
@@ -593,7 +602,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
if ( name.s )
{
microcode_set_module(mbi.mods_count);
- split_value(name.s);
+ place_string(&mb_modules[mbi.mods_count].string, name.s);
+ truncate_string(name.s);
load_file(dir_handle, s2w(&name), &ucode);
efi_bs->FreePool(name.w);
}
@@ -601,7 +611,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
name.s = get_value(&cfg, section.s, "xsm");
if ( name.s )
{
- split_value(name.s);
+ place_string(&mb_modules[mbi.mods_count].string, name.s);
+ truncate_string(name.s);
load_file(dir_handle, s2w(&name), &xsm);
efi_bs->FreePool(name.w);
}
Replace the split_value() function with a more generic string handling function truncate_string(). split_value() used to update the multiboot structures directly, and this has been moved to the call sites to allow truncate_string() to be more generic. Signed-off-by: Roy Franz <roy.franz@linaro.org> --- xen/arch/x86/efi/boot.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)