From patchwork Fri Sep 4 15:05:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 53111 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 4135222E23 for ; Fri, 4 Sep 2015 15:15:45 +0000 (UTC) Received: by lamp12 with SMTP id p12sf8059610lam.2 for ; Fri, 04 Sep 2015 08:15:44 -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=3rBkgHaqF81fEV/fFCGXJugv5b17CxgLCBSzZGyfDy4=; b=YdEINywgA55cR0ZUGXUW1cnGzZxp4FXnYd+OQn4FGG5Jb3VE1ze1DYku7BOw7Ayzt+ dte21AP5+UVxevaXkQNTXhVZN5Sp1QN4uGzIG13PrOENsKLFDfPxVgVsczx7s9X4H7SV z+VyumwZzlyCqken1X1Phqt8QHAtK2Ko/63KWTsyXgHNVkwqIW9eas0Uo9xFAptUJ0kq Jh645JqkOmMvFdzkkDERvV4sgb5ZODl10jhq6peH3wF3FZ0bQhiP/OZ/p5yztTzc8YMT usirr8yIYaDSt58V9h4n7IUOLqDkkp88FhnkQWNW4ZdksHxrUc5AHhrH3I8Dt91E3XQi 5YnQ== X-Gm-Message-State: ALoCoQkWP58XsQTqlAQ4D2fQ+GBBqZHTQAJ1F/Tu4Bo8zzDjEBbYbjenSxeYssSi8tYc7nIFcXTA X-Received: by 10.112.48.41 with SMTP id i9mr1173346lbn.23.1441379744215; Fri, 04 Sep 2015 08:15:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls353855lau.23.gmail; Fri, 04 Sep 2015 08:15:43 -0700 (PDT) X-Received: by 10.152.27.100 with SMTP id s4mr4239895lag.122.1441379743936; Fri, 04 Sep 2015 08:15:43 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ng4si2556613lbc.115.2015.09.04.08.15.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 08:15:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbpo4 with SMTP id o4so13120145lbp.2 for ; Fri, 04 Sep 2015 08:15:43 -0700 (PDT) X-Received: by 10.112.151.106 with SMTP id up10mr72532lbb.106.1441379743779; Fri, 04 Sep 2015 08:15:43 -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.164.42 with SMTP id yn10csp2050673lbb; Fri, 4 Sep 2015 08:15:42 -0700 (PDT) X-Received: by 10.55.214.18 with SMTP id t18mr6112402qki.27.1441379742877; Fri, 04 Sep 2015 08:15:42 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 101si3126465qkt.38.2015.09.04.08.15.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 04 Sep 2015 08:15:42 -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]:60618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsiL-0000Xa-Gj for patch@linaro.org; Fri, 04 Sep 2015 11:15:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsZC-000067-AO for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXsZB-0000si-95 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:14 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsZB-0000iE-30 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:13 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZXsYu-0006FA-H8 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 16:05:56 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 4 Sep 2015 16:05:38 +0100 Message-Id: <1441379156-23939-10-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1441379156-23939-1-git-send-email-peter.maydell@linaro.org> References: <1441379156-23939-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 09/27] target-arm/arm-semi.c: SYS_EXIT on A64 takes a parameter block 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.217.169 as permitted sender) smtp.mailfrom=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 The A64 semihosting API changes the interface for SYS_EXIT so that instead of taking a single exception type in a register, it takes a parameter block containing the exception type and a sub-code. Implement this. Signed-off-by: Peter Maydell Tested-by: Christopher Covington Message-id: 1439483745-28752-9-git-send-email-peter.maydell@linaro.org --- target-arm/arm-semi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c index 1d0d7aa..d7cff3d 100644 --- a/target-arm/arm-semi.c +++ b/target-arm/arm-semi.c @@ -619,9 +619,24 @@ target_ulong do_arm_semihosting(CPUARMState *env) return 0; } case TARGET_SYS_EXIT: - /* ARM specifies only Stopped_ApplicationExit as normal - * exit, everything else is considered an error */ - ret = (args == ADP_Stopped_ApplicationExit) ? 0 : 1; + if (is_a64(env)) { + /* The A64 version of this call takes a parameter block, + * so the application-exit type can return a subcode which + * is the exit status code from the application. + */ + GET_ARG(0); + GET_ARG(1); + + if (arg0 == ADP_Stopped_ApplicationExit) { + ret = arg1; + } else { + ret = 1; + } + } else { + /* ARM specifies only Stopped_ApplicationExit as normal + * exit, everything else is considered an error */ + ret = (args == ADP_Stopped_ApplicationExit) ? 0 : 1; + } gdb_exit(env, ret); exit(ret); case TARGET_SYS_SYNCCACHE: