On 26 May 2015 at 17:03, Leon Alrae <leon.al...@imgtec.com> 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 <leon.al...@imgtec.com>
> --- 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