From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yuziu-0000Yk-4k for qemu-devel@nongnu.org; Wed, 20 May 2015 04:51:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yuziq-0004m5-T0 for qemu-devel@nongnu.org; Wed, 20 May 2015 04:51:32 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:24034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yuziq-0004lt-Nz for qemu-devel@nongnu.org; Wed, 20 May 2015 04:51:28 -0400 Message-ID: <555C4B06.6060608@imgtec.com> Date: Wed, 20 May 2015 09:51:18 +0100 From: Leon Alrae MIME-Version: 1.0 References: <1431085311-24617-1-git-send-email-leon.alrae@imgtec.com> <1431085311-24617-3-git-send-email-leon.alrae@imgtec.com> <555C41BF.3070900@imgtec.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit 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: Liviu Ionescu Cc: Peter Maydell , Christopher Covington , QEMU Developers , Matthew Fortune On 20/05/2015 09:30, Liviu Ionescu wrote: > >> On 20 May 2015, at 11:11, Leon Alrae wrote: >> >> like "If both are specified, -kernel/-append are ignored (-kernel is >> used to load an image, but the path won't be passed to semihosting)" > ... >> We could initialize semihosting.argv[0] with -kernel > > > here you have a small contradiction, both in the current ARM implementation, and in your proposal, the full kernel path is passed as argv[0]. These are two different cases: 1) If both "--semihosting-config arg" and -kernel/-append are specified in QEMU command line, then -kernel/-append is ignored and semihosting.argv[0] is set with first arg string instead of -kernel path, arg[1] with second arg, and so on. 2) If we are in semihosting mode but no "--semihosting-config arg" were specified then argv[0] is set with full path from -kernel, and argv[1] is set with -append. This is compatible with what ARM is currently doing I believe. The following example would support above two cases arm-semi.c: - pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename); - pstrcat(output_buffer, output_size, " "); - pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline); + if (semihosting_get_argc()) { + pstrcat(output_buffer, output_size, semihosting_get_arg(0)); + for (i = 1; i < semihosting_get_argc(); i++) { + pstrcat(output_buffer, output_size, " "); + pstrcat(output_buffer, output_size, semihosting_get_arg(i)); + } + } Leon