ia64/xen-unstable

changeset 15796:2eb38cefdcd9

Skipping image name at start of command line is an
architecture-specific action. Definitely not required on IA64, for now
make it just x86 specific.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Aug 29 15:43:53 2007 +0100 (2007-08-29)
parents c868eab6c99b
children b485d8d7347a
files xen/arch/x86/setup.c xen/common/kernel.c
line diff
     1.1 --- a/xen/arch/x86/setup.c	Wed Aug 29 15:02:41 2007 +0100
     1.2 +++ b/xen/arch/x86/setup.c	Wed Aug 29 15:43:53 2007 +0100
     1.3 @@ -429,10 +429,22 @@ void init_done(void)
     1.4      startup_cpu_idle_loop();
     1.5  }
     1.6  
     1.7 +static char * __init cmdline_cook(char *p)
     1.8 +{
     1.9 +    p = p ? : "";
    1.10 +    while ( *p == ' ' )
    1.11 +        p++;
    1.12 +    while ( (*p != ' ') && (*p != '\0') )
    1.13 +        p++;
    1.14 +    while ( *p == ' ' )
    1.15 +        p++;
    1.16 +    return p;
    1.17 +}
    1.18 +
    1.19  void __init __start_xen(unsigned long mbi_p)
    1.20  {
    1.21      char *memmap_type = NULL;
    1.22 -    char __cmdline[] = "", *cmdline = __cmdline, *kextra;
    1.23 +    char *cmdline, *kextra;
    1.24      unsigned long _initrd_start = 0, _initrd_len = 0;
    1.25      unsigned int initrdidx = 1;
    1.26      char *_policy_start = NULL;
    1.27 @@ -451,8 +463,8 @@ void __init __start_xen(unsigned long mb
    1.28      set_intr_gate(TRAP_page_fault, &early_page_fault);
    1.29  
    1.30      /* Parse the command-line options. */
    1.31 -    if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) )
    1.32 -        cmdline = __va(mbi->cmdline);
    1.33 +    cmdline = cmdline_cook((mbi->flags & MBI_CMDLINE) ?
    1.34 +                           __va(mbi->cmdline) : NULL);
    1.35      if ( (kextra = strstr(cmdline, " -- ")) != NULL )
    1.36      {
    1.37          /*
    1.38 @@ -1037,18 +1049,8 @@ void __init __start_xen(unsigned long mb
    1.39      {
    1.40          static char dom0_cmdline[MAX_GUEST_CMDLINE];
    1.41  
    1.42 -        dom0_cmdline[0] = '\0';
    1.43 -
    1.44 -        if ( cmdline != NULL )
    1.45 -        {
    1.46 -            /* Skip past the image name and copy to a local buffer. */
    1.47 -            while ( *cmdline == ' ' ) cmdline++;
    1.48 -            if ( (cmdline = strchr(cmdline, ' ')) != NULL )
    1.49 -            {
    1.50 -                while ( *cmdline == ' ' ) cmdline++;
    1.51 -                safe_strcpy(dom0_cmdline, cmdline);
    1.52 -            }
    1.53 -        }
    1.54 +        cmdline = cmdline_cook(cmdline);
    1.55 +        safe_strcpy(dom0_cmdline, cmdline);
    1.56  
    1.57          if ( kextra != NULL )
    1.58              /* kextra always includes exactly one leading space. */
     2.1 --- a/xen/common/kernel.c	Wed Aug 29 15:02:41 2007 +0100
     2.2 +++ b/xen/common/kernel.c	Wed Aug 29 15:43:53 2007 +0100
     2.3 @@ -34,12 +34,6 @@ void cmdline_parse(char *cmdline)
     2.4      if ( p == NULL )
     2.5          return;
     2.6  
     2.7 -    /* Skip whitespace and the image name. */
     2.8 -    while ( *p == ' ' )
     2.9 -        p++;
    2.10 -    if ( (p = strchr(p, ' ')) == NULL )
    2.11 -        return;
    2.12 -
    2.13      for ( ; ; )
    2.14      {
    2.15          /* Skip whitespace. */