From patchwork Mon Jun 30 23:09:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 32839 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EC557203F4 for ; Tue, 1 Jul 2014 01:00:13 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf55380827obc.3 for ; Mon, 30 Jun 2014 18:00:13 -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=/Z8whp2N2TU7ugXOJtuUuqkX7TFflk/bjiSRI8uaRKM=; b=NtjCfFZmlrF1z7YahzzHPb+vEdycm7t8UX1nq3RjEIJRDUehtw+EMzGSTfSSydM/UJ I5kJXyhku/4DPcEVtSOl5DSVJmHcdWcEf5+P+JdsemQm19BxA5q+yhLxkdYvDVwt7I0l 5nbEBJL4QrnVBshZn7i7Kx0bHwy6qyF5360u7Lyd2XoykzC6FDGhhj0w2X0UpyOMfQJj JZX3SKzzXxZfkiz4mg99Jl0U8DcgrQw6IO/lUo5yJ/qEXkSU5wRXnzrFDw8TNVODykgq FWdjObV3GKD68iyB5ph4gMosxPv3NyoRbquVzMhKrq877iVlMXcNJUjK6mZu/5cUnmkQ u0mw== X-Gm-Message-State: ALoCoQkrMZnIE2izI+bzTwJEST1YioEVkfZfAR99t4nax8rmmVs2PRnK8CKC+NktxTf4ZKsrYAo6 X-Received: by 10.42.39.140 with SMTP id h12mr22094469ice.9.1404176413219; Mon, 30 Jun 2014 18:00:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.70 with SMTP id 64ls1742635qgs.14.gmail; Mon, 30 Jun 2014 18:00:13 -0700 (PDT) X-Received: by 10.58.8.12 with SMTP id n12mr41088449vea.28.1404176413104; Mon, 30 Jun 2014 18:00:13 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id o5si10803699vez.30.2014.06.30.18.00.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 18:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id db11so8866000veb.4 for ; Mon, 30 Jun 2014 18:00:13 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr41104187vcb.2.1404176412967; Mon, 30 Jun 2014 18:00:12 -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.221.37.5 with SMTP id tc5csp179612vcb; Mon, 30 Jun 2014 18:00:12 -0700 (PDT) X-Received: by 10.224.111.196 with SMTP id t4mr67217443qap.63.1404176412402; Mon, 30 Jun 2014 18:00:12 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 19si27491630qgm.95.2014.06.30.18.00.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 18:00:12 -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]:37077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kn4-0001wR-6Y for patch@linaro.org; Mon, 30 Jun 2014 19:15:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kis-0005m5-6G for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:10:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1kim-0003Jk-Vg for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:10:54 -0400 Received: from mail-ob0-f171.google.com ([209.85.214.171]:58031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kim-0003JM-Ia for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:10:48 -0400 Received: by mail-ob0-f171.google.com with SMTP id nu7so9686352obb.30 for ; Mon, 30 Jun 2014 16:10:48 -0700 (PDT) X-Received: by 10.60.46.229 with SMTP id y5mr46635390oem.7.1404169848283; Mon, 30 Jun 2014 16:10:48 -0700 (PDT) Received: from gbellows-linaro.bellowshome.net (99-179-1-128.lightspeed.austtx.sbcglobal.net. [99.179.1.128]) by mx.google.com with ESMTPSA id cu7sm76370192oec.12.2014.06.30.16.10.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:10:47 -0700 (PDT) From: greg.bellows@linaro.org To: qemu-devel@nongnu.org Date: Mon, 30 Jun 2014 18:09:12 -0500 Message-Id: <1404169773-20264-13-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404169773-20264-1-git-send-email-greg.bellows@linaro.org> References: <1404169773-20264-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.171 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, Fabian Aggeler , Greg Bellows , serge.fdrv@gmail.com, edgar.iglesias@gmail.com, christoffer.dall@linaro.org Subject: [Qemu-devel] [PATCH v4 12/33] target-arm: use dedicated target_el 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: greg.bellows@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.128.173 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: Fabian Aggeler Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows --- target-arm/helper.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 4233ae3..456b7e7 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -3444,14 +3444,10 @@ unsigned int arm_excp_target_el(CPUState *cs, unsigned int excp_idx) CPUARMState *env = cs->env_ptr; unsigned int cur_el = arm_current_pl(env); unsigned int target_el = 1; + unsigned int target_mode; bool route_to_el2 = false; - /* FIXME: Use actual secure state. */ - bool secure = false; - if (!env->aarch64) { - /* TODO: Add EL2 and 3 exception handling for AArch32. */ - return 1; - } + bool secure = arm_is_secure(env); if (!secure && arm_feature(env, ARM_FEATURE_EL2) @@ -3473,18 +3469,10 @@ unsigned int arm_excp_target_el(CPUState *cs, unsigned int excp_idx) } break; case EXCP_FIQ: - case EXCP_IRQ: { - const uint64_t hcr_mask = excp_idx == EXCP_FIQ ? HCR_FMO : HCR_IMO; - const uint32_t scr_mask = excp_idx == EXCP_FIQ ? SCR_FIQ : SCR_IRQ; - - if (!secure && (env->cp15.hcr_el2 & hcr_mask)) { - target_el = 2; - } - if (env->cp15.scr_el3 & scr_mask) { - target_el = 3; - } - break; - } + case EXCP_IRQ: + target_el = arm_phys_excp_target_el(cs, &target_mode, excp_idx, + cur_el, secure); + break; case EXCP_VIRQ: case EXCP_VFIQ: target_el = 1;