From patchwork Fri Jun 26 13:31:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 50352 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 01FCB22902 for ; Fri, 26 Jun 2015 13:34:30 +0000 (UTC) Received: by lbcui10 with SMTP id ui10sf26758650lbc.0 for ; Fri, 26 Jun 2015 06:34:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=kD4JY+shl3ioNtFUwbz9geHa1YG5K7gfvTGEuH4+Bnk=; b=bZOa11ZSPSvF8QIjmVWCZR4oOnDOYhyMX6HnshY0/fJcfxR9s/KeeExAEJh6iWxElC mvwxTB9JrhQOhv0xvgdWq1jnj/dJK4xnmPYaG9KhERSEd5U1Fyd7b913WYwrTlZsHzsR /knUhS3587WhCETMcnRthvHoDFXCuWSjtXqNhoa98lDmZ6cC0jB6peJR3nxMqdtWY8ZD grAKAii5FAOxJuKST/2rWsuZ304AEorFxaPn6pytTACwkbRwFcZCJ73K3AGvJrE2OQN4 7Pfsm3ksqn4woCM8HYyC/E2Okz6aYS9A08EBzKVZNWzkmXMXROy1+HIIe7+Chcl8o+dd lspA== X-Gm-Message-State: ALoCoQkcng9s7nWfj4N5TTdtWK/PrQxDb3BHglNSp4xAV6OR0Sm0ZceX+VWz/k05F9BAAMkvTSL1 X-Received: by 10.180.105.226 with SMTP id gp2mr1920438wib.1.1435325668940; Fri, 26 Jun 2015 06:34:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.201 with SMTP id p9ls515139lae.42.gmail; Fri, 26 Jun 2015 06:34:28 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr1700682lbb.56.1435325668786; Fri, 26 Jun 2015 06:34:28 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id h4si27419649lbm.158.2015.06.26.06.34.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 06:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lacny3 with SMTP id ny3so63634909lac.3 for ; Fri, 26 Jun 2015 06:34:28 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr1641299lbc.19.1435325668704; Fri, 26 Jun 2015 06:34:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1331265lbb; Fri, 26 Jun 2015 06:34:27 -0700 (PDT) X-Received: by 10.140.237.147 with SMTP id i141mr2305490qhc.25.1435325664659; Fri, 26 Jun 2015 06:34:24 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h3si32919704qkh.103.2015.06.26.06.34.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Jun 2015 06:34:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Tlv-0006v8-Rc for patch@linaro.org; Fri, 26 Jun 2015 09:34:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TjG-0002N7-Eq for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8TjC-0001X6-9m for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:38 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TjC-0001QX-1c for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:34 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Z8Tj2-0005Gb-4r for qemu-devel@nongnu.org; Fri, 26 Jun 2015 14:31:24 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 26 Jun 2015 14:31:19 +0100 Message-Id: <1435325484-20208-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1435325484-20208-1-git-send-email-peter.maydell@linaro.org> References: <1435325484-20208-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 3/7] target-arm: default empty semihosting cmdline X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Liviu Ionescu If neither explicit semihosting args nor -kernel are used, make SYS_GET_CMDLINE return an empty string. Signed-off-by: Liviu Ionescu Message-id: AC7B5AFC-06AE-4FAD-9852-B65708E80E09@livius.net Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target-arm/arm-semi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c index 74a67e9..a2a7369 100644 --- a/target-arm/arm-semi.c +++ b/target-arm/arm-semi.c @@ -436,12 +436,19 @@ uint32_t do_arm_semihosting(CPUARMState *env) size_t input_size; size_t output_size; int status = 0; +#if !defined(CONFIG_USER_ONLY) + const char *cmdline; +#endif GET_ARG(0); GET_ARG(1); input_size = arg1; /* Compute the size of the output string. */ #if !defined(CONFIG_USER_ONLY) - output_size = strlen(semihosting_get_cmdline()) + 1; + cmdline = semihosting_get_cmdline(); + if (cmdline == NULL) { + cmdline = ""; /* Default to an empty line. */ + } + output_size = strlen(cmdline) + 1; /* Count terminating 0. */ #else unsigned int i; @@ -472,7 +479,7 @@ uint32_t do_arm_semihosting(CPUARMState *env) /* Copy the command-line arguments. */ #if !defined(CONFIG_USER_ONLY) - pstrcpy(output_buffer, output_size, semihosting_get_cmdline()); + pstrcpy(output_buffer, output_size, cmdline); #else if (output_size == 1) { /* Empty command-line. */