From patchwork Fri Mar 27 16:22:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Covington X-Patchwork-Id: 46448 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F257821597 for ; Fri, 27 Mar 2015 21:36:18 +0000 (UTC) Received: by lajy8 with SMTP id y8sf3052666laj.3 for ; Fri, 27 Mar 2015 14:36:17 -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:cc: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=Ovtu0bz/X/aAPHOLEeAtrQvjOCNndpCHC+TiIwvo+3A=; b=cIgsFom9FzSJEp/5+zhvEbnb2hJavWUjNWsCbQ2HXDluvk1f7dpbrlxCcnaqdC+iOv 0XWc42JDG9zIA25VG9tHqb5HY2bE2PXxlnk9gxyF7G+BPWZsWbDJZd21TyMc1UYhlp2d p0j5bfRltJFjvbCNnD1EFwAAJmDhcU2o6qqaKB2PaREBF8nS8v2vdbCXX+KAXmu079QE aRTZLzW9Zn8iV3ocbYUcmP61rD0nxhrsyg9aRBSiUHtmcUZK+uhRh00IwoHLEM0unXSN LepAM8R6pZLMZfm5lmsdy+V4AY2W4voAjiSaJQVNOrhUVErTAn3penk0RH2sp+OvxZbt Bm+g== X-Gm-Message-State: ALoCoQn6HelzwaBUSjDayq+0xWrjMyh4+5wip4YfSRzkbiAtHSetXFon5OIjw4Hd80WdXJ6epwJ9 X-Received: by 10.152.88.33 with SMTP id bd1mr5148140lab.2.1427492177660; Fri, 27 Mar 2015 14:36:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.168 with SMTP id a8ls396314lab.14.gmail; Fri, 27 Mar 2015 14:36:17 -0700 (PDT) X-Received: by 10.112.134.167 with SMTP id pl7mr18965675lbb.63.1427492177329; Fri, 27 Mar 2015 14:36:17 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id 6si2164174lal.25.2015.03.27.14.36.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 14:36:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labto5 with SMTP id to5so80541916lab.0 for ; Fri, 27 Mar 2015 14:36:17 -0700 (PDT) X-Received: by 10.152.19.199 with SMTP id h7mr19943275lae.32.1427492177196; Fri, 27 Mar 2015 14:36:17 -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.57.201 with SMTP id k9csp124048lbq; Fri, 27 Mar 2015 14:36:16 -0700 (PDT) X-Received: by 10.55.21.39 with SMTP id f39mr43003347qkh.44.1427492175811; Fri, 27 Mar 2015 14:36:15 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l63si3142685qhl.27.2015.03.27.14.36.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Mar 2015 14:36:15 -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]:52037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbbvK-0005NW-Ok for patch@linaro.org; Fri, 27 Mar 2015 17:36:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbX2Q-0007v8-Dh for qemu-devel@nongnu.org; Fri, 27 Mar 2015 12:23:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbX2N-0005hD-8j for qemu-devel@nongnu.org; Fri, 27 Mar 2015 12:23:14 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:32788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbX2N-0005gx-3T for qemu-devel@nongnu.org; Fri, 27 Mar 2015 12:23:11 -0400 Received: by pabxg6 with SMTP id xg6so100061384pab.0 for ; Fri, 27 Mar 2015 09:23:10 -0700 (PDT) X-Received: by 10.68.89.4 with SMTP id bk4mr36645251pbb.80.1427473390539; Fri, 27 Mar 2015 09:23:10 -0700 (PDT) Received: from covaro.wlan.qualcomm.com (rrcs-67-52-130-29.west.biz.rr.com. [67.52.130.29]) by mx.google.com with ESMTPSA id v7sm2615045pds.72.2015.03.27.09.23.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Mar 2015 09:23:09 -0700 (PDT) From: Christopher Covington To: qemu-devel@nongnu.org, Peter Maydell Date: Fri, 27 Mar 2015 12:22:34 -0400 Message-Id: <1427473355-17129-3-git-send-email-christopher.covington@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427473355-17129-1-git-send-email-christopher.covington@linaro.org> References: <1427473355-17129-1-git-send-email-christopher.covington@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.48 X-Mailman-Approved-At: Fri, 27 Mar 2015 17:34:18 -0400 Cc: Liviu Ionescu , Christopher Covington Subject: [Qemu-devel] [PATCH 2/3] arm: semihosting: Create unsupported call function 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: christopher.covington@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.42 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 This will allow the print-error-and-exit sequence to be called from a second location in a subsequent patch. The type of the nr variable is changed from int to uint32_t since I'm unaware of semihosting call numbers needing more than 32 bits, even on AArch64. Also generalize the wording of the unsupported semihosting call error message so that it will make sense on AArch64 as well. Signed-off-by: Christopher Covington --- target-arm/arm-semi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c index a8b83e6..d915123 100644 --- a/target-arm/arm-semi.c +++ b/target-arm/arm-semi.c @@ -174,6 +174,13 @@ static void arm_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err) #endif } +static void QEMU_NORETURN unsupported_semihosting(uint32_t nr, CPUState *cs) +{ + fprintf(stderr, "qemu: Unsupported semihosting call 0x%02x\n", nr); + cpu_dump_state(cs, stderr, fprintf, 0); + abort(); +} + /* Read the input value from the argument block; fail the semihosting * call if the memory read fails. */ @@ -191,7 +198,7 @@ uint32_t do_arm_semihosting(CPUARMState *env) target_ulong args; target_ulong arg0, arg1, arg2, arg3; char * s; - int nr; + uint32_t nr; uint32_t ret; uint32_t len; #ifdef CONFIG_USER_ONLY @@ -561,8 +568,6 @@ uint32_t do_arm_semihosting(CPUARMState *env) gdb_exit(env, ret); exit(ret); default: - fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); - cpu_dump_state(cs, stderr, fprintf, 0); - abort(); + unsupported_semihosting(nr, cs); } }