From patchwork Fri Jan 23 18:20: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: 43692 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1D526218DB for ; Fri, 23 Jan 2015 18:20:58 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id l61sf5057226wev.0 for ; Fri, 23 Jan 2015 10:20:57 -0800 (PST) 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=3uhKvjVtq3ZykSsfXsc2u7R28uZrmeP1VsJjzPJYzlw=; b=THUSVHqHjw4KV5RDThQvKHorsp3jELSn2X6zZc+FySN9VBnWw0dE9VwSJam6+mv60V SwvkrKB8cHbUF3c3DT3J9sf99ECvCM5fWo8M86vMGsFHAbknEDVwicDOJ5QrOoMM/Vlf NGBgsfWeRfBDCGRrNMkikstdf52ObK7Z+aG4/aWLU5sQ2PLnazt1SklXpOxTsXXSE+UV r4JvfGrB+29kLEn1NBwQCqGQH15bHY/1dhjwREVz4XD53pC4HTfSSKKEI/cXfMvO6WnL KKP3l83ct9gzq365h1mSJg+LliIEmn198nplMKbNjVY0fUZ2KG/1E6mWRDh+6dE/PXpv TT0g== X-Gm-Message-State: ALoCoQk7RmskAES2vV7Vo5xqYz7OSYrlCh33sDzNMdrYqkSJY8eeqWPZLCQ6GtjZcV9IoyB83yqn X-Received: by 10.152.2.40 with SMTP id 8mr96lar.7.1422037257347; Fri, 23 Jan 2015 10:20:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.9 with SMTP id r9ls320811lae.31.gmail; Fri, 23 Jan 2015 10:20:57 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr8702408lbc.23.1422037257174; Fri, 23 Jan 2015 10:20:57 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id sg5si2056571lbb.19.2015.01.23.10.20.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jan 2015 10:20:57 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id ge10so4611702lab.11 for ; Fri, 23 Jan 2015 10:20:57 -0800 (PST) X-Received: by 10.112.52.229 with SMTP id w5mr8875203lbo.52.1422037257100; Fri, 23 Jan 2015 10:20:57 -0800 (PST) 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.9.200 with SMTP id c8csp344158lbb; Fri, 23 Jan 2015 10:20:56 -0800 (PST) X-Received: by 10.180.96.33 with SMTP id dp1mr766930wib.13.1422037245224; Fri, 23 Jan 2015 10:20:45 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id dk6si4566427wjb.113.2015.01.23.10.20.44 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Jan 2015 10:20:45 -0800 (PST) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YEiqK-0001P5-AT; Fri, 23 Jan 2015 18:20:28 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Greg Bellows , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Edgar E. Iglesias" , Andrew Jones Subject: [PATCH 02/11] target-arm: Make arm_current_el() return sensible values for M profile Date: Fri, 23 Jan 2015 18:20:19 +0000 Message-Id: <1422037228-5363-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1422037228-5363-1-git-send-email-peter.maydell@linaro.org> References: <1422037228-5363-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.215.52 as permitted sender) smtp.mail=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: , Although M profile doesn't have the same concept of exception level as A profile, it does have a notion of privileged versus not, which we currently track in the privmode TB flag. Support returning this information if arm_current_el() is called on an M profile core, so that we can identify the correct MMU index to use (and put the MMU index in the TB flags) without having to special-case M profile. Signed-off-by: Peter Maydell Reviewed-by: Greg Bellows --- target-arm/cpu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index cd7a9e8..3eb00f4 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -1211,6 +1211,10 @@ static inline bool cptype_valid(int cptype) */ static inline int arm_current_el(CPUARMState *env) { + if (arm_feature(env, ARM_FEATURE_M)) { + return !((env->v7m.exception == 0) && (env->v7m.control & 1)); + } + if (is_a64(env)) { return extract32(env->pstate, 2, 2); }