qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 2/2] semihosting: add --semihosting-config ar


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v4 2/2] semihosting: add --semihosting-config arg sub-argument
Date: Fri, 5 Jun 2015 16:23:08 +0100

On 26 May 2015 at 17:03, Leon Alrae <address@hidden> wrote:
> Add new "arg" sub-argument to the --semihosting-config allowing the user
> to pass multiple input arguments separately. It is required for example
> by UHI semihosting to construct argc and argv.
>
> Also, update ARM semihosting to support new option (at the moment it is
> the only target which cares about arguments).
>
> If the semihosting is enabled and no semihosting args have been specified,
> then fall back to -kernel/-append. The -append string is split on whitespace
> before initializing semihosting.argv[1..n]; this is different from what
> QEMU MIPS machines' pseudo-bootloaders do (i.e. argv[1] contains the whole
> -append), but is more intuitive from UHI user's point of view and Linux
> kernel just does not care as it concatenates argv[1..n] into single cmdline
> string anyway.
>
> Signed-off-by: Leon Alrae <address@hidden>

> --- a/target-arm/arm-semi.c
> +++ b/target-arm/arm-semi.c
> @@ -27,6 +27,7 @@
>  #include <time.h>
>
>  #include "cpu.h"
> +#include "exec/semihost.h"
>  #ifdef CONFIG_USER_ONLY
>  #include "qemu.h"
>
> @@ -440,10 +441,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)
>              input_size = arg1;
>              /* Compute the size of the output string.  */
>  #if !defined(CONFIG_USER_ONLY)
> -            output_size = strlen(ts->boot_info->kernel_filename)
> -                        + 1  /* Separating space.  */
> -                        + strlen(ts->boot_info->kernel_cmdline)
> -                        + 1; /* Terminating null byte.  */
> +            output_size = strlen(semihosting_get_cmdline()) + 1;

It looks like semihosting_get_cmdline() can return NULL,
in which case this will blow up, I think.

Patch looks OK otherwise (haven't tested it yet).

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]