From patchwork Wed Dec 4 19:33:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22037 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 4422A202E0 for ; Wed, 4 Dec 2013 19:57:26 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf52238271obc.11 for ; Wed, 04 Dec 2013 11:57:25 -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=VcqoU8Rg7xLv7uRqd/+s3EN5Rzn598HxJp83aeLMIeM=; b=EbvqHLiersEgM9xYR+Lu9gvpy5bC6/ZnZ7gfusiN028ltoEHry7Sk2y0yJIYkfmGFG 0YJyzHkTVrua8mPNMYPMvTmruBfb5NDDh9LLSS841I+jvQRoYYaLB/JPN9Q+wqaNU3sS TE3OvMlVzo7lcbc5FGkwz+btCcu9LxNfBKy8iui6Uc6Ep9MdIxk8GuDWHPgFbcnAv6U1 6nXf3qB8KbxvGn3fhIp5O3HD/npDa1G59o1fp8jQY9ze537laZemDbsC0xPBKDZJmz57 i6acMJV+REtCo4ji8p5OMzXnKfYxuDNa4PmSJ2imV527V+Pny7qbGMvUdYhODjSxYasI M2vA== X-Gm-Message-State: ALoCoQmz+mwI+4G2PLIuaQhOZkYGxdl0Np6EubFGeC/AWzSNIsD0u4+8LH2w2+gJATr4iyMSr+qi X-Received: by 10.182.245.197 with SMTP id xq5mr26854514obc.27.1386187045556; Wed, 04 Dec 2013 11:57:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.10 with SMTP id q10ls459116qen.0.gmail; Wed, 04 Dec 2013 11:57:25 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr10319741ved.20.1386187045406; Wed, 04 Dec 2013 11:57:25 -0800 (PST) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id om4si33271129vcb.68.2013.12.04.11.57.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Dec 2013 11:57:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.172 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.172; Received: by mail-vc0-f172.google.com with SMTP id hz11so11824932vcb.17 for ; Wed, 04 Dec 2013 11:57:25 -0800 (PST) X-Received: by 10.220.147.16 with SMTP id j16mr2778515vcv.28.1386187045034; Wed, 04 Dec 2013 11:57:25 -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 u4csp319828vcz; Wed, 4 Dec 2013 11:57:24 -0800 (PST) X-Received: by 10.180.149.175 with SMTP id ub15mr8983933wib.10.1386187044216; Wed, 04 Dec 2013 11:57:24 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id ll10si9595592wjb.24.2013.12.04.11.57.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 04 Dec 2013 11:57:24 -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 1VoICP-0006e2-8p; Wed, 04 Dec 2013 19:33:29 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , C Fontana , Dirk Mueller , Michael Matz , Laurent Desnogues , Richard Henderson , kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 03/12] target-arm: A64: provide functions for accessing FPCR and FPSR Date: Wed, 4 Dec 2013 19:33:20 +0000 Message-Id: <1386185609-25505-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386185609-25505-1-git-send-email-peter.maydell@linaro.org> References: <1386185609-25505-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.172 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: , The information which AArch32 holds in the FPSCR is split for AArch64 into two logically distinct registers, FPSR and FPCR. Since they are carefully arranged to use non-overlapping bits, we leave the underlying state in the same place, and provide accessor functions which just update the appropriate bits via vfp_get_fpscr() and vfp_set_fpscr(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target-arm/cpu.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index ff7aac5..4807354 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -445,6 +445,34 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) uint32_t vfp_get_fpscr(CPUARMState *env); void vfp_set_fpscr(CPUARMState *env, uint32_t val); +/* For A64 the FPSCR is split into two logically distinct registers, + * FPCR and FPSR. However since they still use non-overlapping bits + * we store the underlying state in fpscr and just mask on read/write. + */ +#define FPSR_MASK 0xf800009f +#define FPCR_MASK 0x07f79f00 +static inline uint32_t vfp_get_fpsr(CPUARMState *env) +{ + return vfp_get_fpscr(env) & FPSR_MASK; +} + +static inline void vfp_set_fpsr(CPUARMState *env, uint32_t val) +{ + uint32_t new_fpscr = (vfp_get_fpscr(env) & ~FPSR_MASK) | (val & FPSR_MASK); + vfp_set_fpscr(env, new_fpscr); +} + +static inline uint32_t vfp_get_fpcr(CPUARMState *env) +{ + return vfp_get_fpscr(env) & FPCR_MASK; +} + +static inline void vfp_set_fpcr(CPUARMState *env, uint32_t val) +{ + uint32_t new_fpscr = (vfp_get_fpscr(env) & ~FPCR_MASK) | (val & FPCR_MASK); + vfp_set_fpscr(env, new_fpscr); +} + enum arm_cpu_mode { ARM_CPU_MODE_USR = 0x10, ARM_CPU_MODE_FIQ = 0x11,