From patchwork Sat Feb 15 16:07:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 24686 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4012C203BE for ; Sat, 15 Feb 2014 16:07:44 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id fa1sf31973963pad.4 for ; Sat, 15 Feb 2014 08:07:43 -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=kDeI4PIo0f7ewIMBJwT0qWEEFb2dg02v4zhHu2fw0qc=; b=HemvvJdGvT88qSXFVwM3KKf8T8/e+6uOGAUGZyrrey8iy6o4Q5she8Oh8tVqvzqPe4 VxGm+xgmjYwAgxdFvb6DD+E2Qqgr9jLfp9pI97VKPk2gPYMrZogbaF38fFbvnRtRTAxa EQqYHn0nr/ee1fq5SNBrETmvn2sKsYz5x8av8R2UU8zBSwm38u6HZHmw0zJFGxauGB/V lmvIbH7isVAa7+dnA8JNPHjhOtQAttw9NtoBpYlHT+rkvN4Bau7zwgwW0FSsSP6lvjlK DQpbm45Glruheq0V0frB6p28d66lRxEibKCwPv+Z9ZTvy2luQhz4/3cRmLhOi+9O+kLx j6nw== X-Gm-Message-State: ALoCoQljZ7wTxXY7zuIi0jXzogFloBZSKTpJnNItiY1yXl4JnTROczKzIyVhjURS/NXAMto/+01e X-Received: by 10.66.253.9 with SMTP id zw9mr6602359pac.38.1392480463414; Sat, 15 Feb 2014 08:07:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.134 with SMTP id b6ls418621qgb.91.gmail; Sat, 15 Feb 2014 08:07:43 -0800 (PST) X-Received: by 10.52.186.230 with SMTP id fn6mr8447683vdc.14.1392480463171; Sat, 15 Feb 2014 08:07:43 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id qt5si3001715vcb.98.2014.02.15.08.07.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Feb 2014 08:07:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ks9so10087817vcb.39 for ; Sat, 15 Feb 2014 08:07:43 -0800 (PST) X-Received: by 10.52.168.39 with SMTP id zt7mr4725100vdb.42.1392480463087; Sat, 15 Feb 2014 08:07:43 -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.220.174.196 with SMTP id u4csp25557vcz; Sat, 15 Feb 2014 08:07:41 -0800 (PST) X-Received: by 10.180.11.233 with SMTP id t9mr6573789wib.1.1392480460458; Sat, 15 Feb 2014 08:07:40 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id fs5si3869183wic.40.2014.02.15.08.07.38 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 15 Feb 2014 08:07:40 -0800 (PST) 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 1WEhm1-0006gA-PT; Sat, 15 Feb 2014 16:07:25 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , Michael Matz , Claudio Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Christoffer Dall , Will Newton , Peter Crosthwaite , Rob Herring Subject: [PATCH v3 21/31] target-arm: Implement AArch64 DAIF system register Date: Sat, 15 Feb 2014 16:07:14 +0000 Message-Id: <1392480444-25565-22-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1392480444-25565-1-git-send-email-peter.maydell@linaro.org> References: <1392480444-25565-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=neutral (google.com: 209.85.220.180 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 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: , Implement the DAIF system register which is a view of the DAIF bits in PSTATE. Signed-off-by: Peter Maydell Reviewed-by: Peter Crosthwaite --- target-arm/helper.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target-arm/helper.c b/target-arm/helper.c index 367fbbe..c50ca5a 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1589,6 +1589,25 @@ static void aa64_fpsr_write(CPUARMState *env, const ARMCPRegInfo *ri, vfp_set_fpsr(env, value); } +static CPAccessResult aa64_daif_access(CPUARMState *env, const ARMCPRegInfo *ri) +{ + if (arm_current_pl(env) == 0 && !(env->cp15.c1_sys & SCTLR_UMA)) { + return CP_ACCESS_TRAP; + } + return CP_ACCESS_OK; +} + +static uint64_t aa64_daif_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + return env->daif; +} + +static void aa64_daif_write(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value) +{ + env->daif = value & PSTATE_DAIF; +} + static CPAccessResult aa64_cacheop_access(CPUARMState *env, const ARMCPRegInfo *ri) { @@ -1632,6 +1651,11 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "NZCV", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 2, .access = PL0_RW, .type = ARM_CP_NZCV }, + { .name = "DAIF", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .opc2 = 1, .crn = 4, .crm = 2, + .type = ARM_CP_NO_MIGRATE, + .access = PL0_RW, .accessfn = aa64_daif_access, + .readfn = aa64_daif_read, .writefn = aa64_daif_write }, { .name = "FPCR", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 0, .crn = 4, .crm = 4, .access = PL0_RW, .readfn = aa64_fpcr_read, .writefn = aa64_fpcr_write },