From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdKxz-00034l-Tx for qemu-devel@nongnu.org; Wed, 01 Apr 2015 11:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdKxv-0006jb-TU for qemu-devel@nongnu.org; Wed, 01 Apr 2015 11:54:07 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdKxv-0006j5-Oi for qemu-devel@nongnu.org; Wed, 01 Apr 2015 11:54:03 -0400 Message-ID: <551C1298.6090702@codeaurora.org> Date: Wed, 01 Apr 2015 11:45:28 -0400 From: Christopher Covington MIME-Version: 1.0 References: <1427894283-31953-1-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1427894283-31953-1-git-send-email-leon.alrae@imgtec.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, ilg@livius.net, matthew.fortune@imgtec.com, christopher.covington@linaro.org Hi Leon, On 04/01/2015 09:18 AM, Leon Alrae wrote: > Signed-off-by: Leon Alrae > --- > Hi, > > Continuing the discussion related to extending QEMU's command line with new > argument allowing to pass semi-hosting input arguments to the guest program: > https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg05960.html > > This simple patch adds "arg" sub-argument which in my opinion is flexible > enough to satisfy semi-hosting interfaces which allocate buffers at runtime > (so it is possible to pass any number of strings of any length) as well as the > ones which have limited buffer for a single input string. > > Highlights: > > * arg can appear multiple times in -semihosting-config group of sub-arguments > and is used to create argc/argv. > > * Single string cmdline can be still easily created: > static void concat_semihosting_args(char *buffer, int buffer_size, > const char *separator) > { > int i; > buffer[0] = '\0'; > for (i = 0; i < semihosting_argc - 1; i++) { > pstrcat(buffer, buffer_size, semihosting_argv[i]); > pstrcat(buffer, buffer_size, separator); > } > pstrcat(buffer, buffer_size, semihosting_argv[i]); > } > > * argv[0] is set by the first occurence of "arg" rather than taking the same > string from "-kernel". This might be required in cases where the path is too > long and semi-hosting app's buffer for the cmdline is fixed and small. > > * No altering the parser itself, just traversing the -semihosting-config opts > and picking all arg strings. > > * This patch doesn't fix the need of using double-commas if user want to have > a comma in the string. > > If we agree on this new option then I would like to follow up with a clean up > where we've got a semi-hosting specific structure rather than keep generating > more semihosting_* variables (I skipped it in this patch to avoid generating > clean up related noise in the diff). I think the commit message and help text should include some information on how this is different from -append and what the result is of specifying both -append foo=a and -semihosting-config arg=foo=b. Thanks, Chris -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project