From patchwork Wed Feb 26 18:02:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25372 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A26220636 for ; Wed, 26 Feb 2014 18:07:11 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf5720483veb.0 for ; Wed, 26 Feb 2014 10:07:11 -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: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=cvK1wAahsYAWdGJaqiOmTpe5m0qyXDSUnxTZ0MtRKUE=; b=cik42/qPcjBADayVXpdq55TYQLl6FB4wbli7aLeR0/QOne+13WRysGCk5ayxCHjSPr ONa5Vj9lbrrCYF8UDUxSVnuII6rDFfeFnhkQ3U6zudAlsU++68HM8LeNPeEhGkjPC2AQ Op+L57+rXWOOk/FtKLcd0w1iH+VW3bzVQyNq0CIaHhs97Tf7tKThH8ynd+dU5sjkYScg K3ciT3K4tZyTGZCTO40BrnQ4oEddpwJpe00SlbzTEzXuaBV3t8wYGf5r/zV+r8rraPqM k68bfrSJB3HAbAqb4RlgqqRFYf4p/IRbP18FrBZ+zuCHVosILvM6B7IC6KSCjMp/Cx7b ldGA== X-Gm-Message-State: ALoCoQk1ph5j3kjuvIdmJE1WSS3ewEpmrIQOdKvuu1hWGXWVIgJY9ipx5Jr5o0OC2SNg8Y8zFaux X-Received: by 10.236.18.196 with SMTP id l44mr2875796yhl.52.1393438031009; Wed, 26 Feb 2014 10:07:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.71 with SMTP id d65ls429691qgf.60.gmail; Wed, 26 Feb 2014 10:07:10 -0800 (PST) X-Received: by 10.58.201.5 with SMTP id jw5mr6701091vec.6.1393438030762; Wed, 26 Feb 2014 10:07:10 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id sx1si431658vdc.49.2014.02.26.10.07.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 10:07:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jy13so2654319veb.27 for ; Wed, 26 Feb 2014 10:07:10 -0800 (PST) X-Received: by 10.52.242.167 with SMTP id wr7mr5855603vdc.32.1393438030683; Wed, 26 Feb 2014 10:07:10 -0800 (PST) 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.220.174.196 with SMTP id u4csp44753vcz; Wed, 26 Feb 2014 10:07:10 -0800 (PST) X-Received: by 10.224.69.199 with SMTP id a7mr7146661qaj.18.1393438030000; Wed, 26 Feb 2014 10:07:10 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v4si1005092qap.7.2014.02.26.10.07.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Feb 2014 10:07:09 -0800 (PST) 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]:42165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIisv-0006WO-Dg for patch@linaro.org; Wed, 26 Feb 2014 13:07:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIioh-0000kR-5l for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:02:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIiof-0007I5-OQ for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:02:47 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:46191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIiof-0007Eu-H8 for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:02:45 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WIioW-00069u-1S; Wed, 26 Feb 2014 18:02:36 +0000 From: Peter Maydell To: Anthony Liguori Date: Wed, 26 Feb 2014 18:02:06 +0000 Message-Id: <1393437755-23586-17-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1393437755-23586-1-git-send-email-peter.maydell@linaro.org> References: <1393437755-23586-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 Cc: Blue Swirl , qemu-devel@nongnu.org, Aurelien Jarno Subject: [Qemu-devel] [PULL 16/45] target-arm: Implement AArch64 CurrentEL sysreg 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=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 Implement the CurrentEL sysreg. Signed-off-by: Peter Maydell Reviewed-by: Peter Crosthwaite --- target-arm/cpu.h | 3 ++- target-arm/helper.c | 3 +++ target-arm/translate-a64.c | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 8c4ed0f..632b4d1 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -731,7 +731,8 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) #define ARM_CP_NOP (ARM_CP_SPECIAL | (1 << 8)) #define ARM_CP_WFI (ARM_CP_SPECIAL | (2 << 8)) #define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8)) -#define ARM_LAST_SPECIAL ARM_CP_NZCV +#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | (4 << 8)) +#define ARM_LAST_SPECIAL ARM_CP_CURRENTEL /* Used only as a terminator for ARMCPRegInfo lists */ #define ARM_CP_SENTINEL 0xffff /* Mask of only the flag bits in a type field */ diff --git a/target-arm/helper.c b/target-arm/helper.c index 2fdf3a7..ff1ed7d 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1533,6 +1533,9 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0, .access = PL0_R, .type = ARM_CP_CONST, .resetvalue = 0x10 }, + { .name = "CURRENTEL", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .opc2 = 2, .crn = 4, .crm = 2, + .access = PL1_R, .type = ARM_CP_CURRENTEL }, REGINFO_SENTINEL }; diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index 8752e7e..ec2d9dc 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -1231,6 +1231,13 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, gen_set_nzcv(tcg_rt); } return; + case ARM_CP_CURRENTEL: + /* Reads as current EL value from pstate, which is + * guaranteed to be constant by the tb flags. + */ + tcg_rt = cpu_reg(s, rt); + tcg_gen_movi_i64(tcg_rt, s->current_pl << 2); + return; default: break; }