From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuNl7-0002Rb-HD for qemu-devel@nongnu.org; Mon, 18 May 2015 12:19:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuNl0-0006ZZ-NU for qemu-devel@nongnu.org; Mon, 18 May 2015 12:19:17 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:38340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuNl0-0006ZU-JI for qemu-devel@nongnu.org; Mon, 18 May 2015 12:19:10 -0400 Received: by igcau1 with SMTP id au1so51962011igc.1 for ; Mon, 18 May 2015 09:19:10 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1431085311-24617-3-git-send-email-leon.alrae@imgtec.com> References: <1431085311-24617-1-git-send-email-leon.alrae@imgtec.com> <1431085311-24617-3-git-send-email-leon.alrae@imgtec.com> From: Peter Maydell Date: Mon, 18 May 2015 17:18:49 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae Cc: Liviu Ionescu , Christopher Covington , QEMU Developers , Matthew Fortune On 8 May 2015 at 12:41, Leon Alrae wrote: > Add new "arg" sub-argument to the --semihosting-config allowing to pass > multiple input argument separately. It is required for example by UHI > semihosting to construct argc and argv. > > Signed-off-by: Leon Alrae > --- > include/exec/semihost.h | 12 ++++++++++++ > qemu-options.hx | 19 ++++++++++++++----- > vl.c | 33 +++++++++++++++++++++++++++++++++ > 3 files changed, 59 insertions(+), 5 deletions(-) > > diff --git a/include/exec/semihost.h b/include/exec/semihost.h > index c2f0bcb..6e4e8c0 100644 > --- a/include/exec/semihost.h > +++ b/include/exec/semihost.h > @@ -36,9 +36,21 @@ static inline SemihostingTarget semihosting_get_target(void) > { > return SEMIHOSTING_TARGET_AUTO; > } > + > +static inline const char *semihosting_get_arg(int i) > +{ > + return NULL; > +} > + > +static inline int semihosting_get_argc(void) > +{ > + return 0; > +} > #else > bool semihosting_enabled(void); > SemihostingTarget semihosting_get_target(void); > +const char *semihosting_get_arg(int i); > +int semihosting_get_argc(void); > #endif > > #endif > diff --git a/qemu-options.hx b/qemu-options.hx > index ec356f6..84ae6c2 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -3296,14 +3296,23 @@ STEXI > Enable semihosting mode (ARM, M68K, Xtensa only). > ETEXI > DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config, > - "-semihosting-config [enable=on|off,]target=native|gdb|auto semihosting configuration\n", > + "-semihosting-config [enable=on|off][,target=native|gdb|auto][,arg=str[,...]]\n" \ > + " semihosting configuration\n", > QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32) > STEXI > -@item -semihosting-config [enable=on|off,]target=native|gdb|auto > +@item -semihosting-config [enable=on|off][,target=native|gdb|auto][,arg=str[,...]] > @findex -semihosting-config > -Enable semihosting and define where the semihosting calls will be addressed, > -to QEMU (@code{native}) or to GDB (@code{gdb}). The default is @code{auto}, which means > -@code{gdb} during debug sessions and @code{native} otherwise (ARM, M68K, Xtensa only). > +Enable and configure semihosting (ARM, M68K, Xtensa only). > +@table @option > +@item target=@code{native|gdb|auto} > +Defines where the semihosting calls will be addressed, to QEMU (@code{native}) > +or to GDB (@code{gdb}). The default is @code{auto}, which means @code{gdb} > +during debug sessions and @code{native} otherwise. > +@item arg=@var{str1},arg=@var{str2},... > +Allows the user to pass input arguments, can be used multiple times to build up > +a list. This is a replacement for the old-style -kernel/-append method of > +passing a command line to semihosting. > +@end table You need to say how this interacts with the -kernel/-append option (ie what happens if you specify both). Also, you haven't actually changed anything so at the moment -arg doesn't do anything. The only semihosting target in-tree which cares about arguments at the moment is ARM. Ideally semihost.h's "get me the command line" function(s) should handle "use -arg if present, fall back to -kernel + -append if not" so the target specific semihosting code doesn't need to care. thanks -- PMM