From patchwork Thu Aug 13 16:35:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 52403 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 5B2A222EC6 for ; Thu, 13 Aug 2015 16:51:52 +0000 (UTC) Received: by lagz9 with SMTP id z9sf19189715lag.3 for ; Thu, 13 Aug 2015 09:51:51 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=A4Hqg1WqGRAzPsDVBXom+ezcyf6Q7KWismzThYDvFTo=; b=cY8f1hMV3B6WCI7wguZUK3hJXV+7Yz+buxkQGNln36d+qAWiQq9ZNpawTa8YSya+X8 87pjK1UJ9h6LOydn39jQZ6ERWrN+NAPnQVko2Q8kfPrFd2qvG60W9zRxWRt50CWYYnr3 VnbyNPYGyhsLUCu7ZWLfxJfP6uqfne5jLm9kaHpNXAZWFeTv7EVNaVpRLYDBkxF32JrF TBAtWem/cYR8Jv7quDE0yeP8Aoq/XHdAEjcQwTyVkeQplxfGkhAvQDB5RhaPVU/zxbxX 6stcqMdUJCtwcJfjqihdYBhaJTo3FgHbnGEivPWR1jtak7ubjdYievA6Dr3HcmTPdBU0 yOSw== X-Gm-Message-State: ALoCoQnxzzb+mLgQMqAiCY0ltT4lWoOzda9jpGIq5cmkK+KinjqRb8gOf7P9CrMcMH7L6R4+IeJZ X-Received: by 10.180.35.162 with SMTP id i2mr8858379wij.6.1439484711305; Thu, 13 Aug 2015 09:51:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.219.34 with SMTP id pl2ls202103lac.84.gmail; Thu, 13 Aug 2015 09:51:51 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr37641339lal.35.1439484711151; Thu, 13 Aug 2015 09:51:51 -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 o10si3100161laf.161.2015.08.13.09.51.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 09:51:51 -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 lbcbn3 with SMTP id bn3so30365925lbc.2 for ; Thu, 13 Aug 2015 09:51:51 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr36738370lbc.41.1439484711059; Thu, 13 Aug 2015 09:51:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1060537lba; Thu, 13 Aug 2015 09:51:50 -0700 (PDT) X-Received: by 10.140.102.103 with SMTP id v94mr34502935qge.44.1439484709702; Thu, 13 Aug 2015 09:51:49 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id z89si4685030qge.29.2015.08.13.09.51.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 13 Aug 2015 09:51:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZPvTl-0007Ui-RG; Thu, 13 Aug 2015 17:35:45 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Christopher Covington Subject: [PATCH 8/9] target-arm/arm-semi.c: SYS_EXIT on A64 takes a parameter block Date: Thu, 13 Aug 2015 17:35:44 +0100 Message-Id: <1439483745-28752-9-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1439483745-28752-1-git-send-email-peter.maydell@linaro.org> References: <1439483745-28752-1-git-send-email-peter.maydell@linaro.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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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: