From patchwork Thu Dec 5 12:39:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22059 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A095423FBA for ; Thu, 5 Dec 2013 12:39:49 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf47823383pdi.10 for ; Thu, 05 Dec 2013 04:39:48 -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=QMWiAL6A55EcUqNnbWB0yNoTG6hW4app3Jsod4stByll9nz7GAK79loPULWVXlxf88 Ow4v561JS0Jp9MtKs5cA+Z4ff5BAyXfL0liRYaCsDpbQdElLotd7u7FB+BGLqukqFMe8 kveX7237L4t/y/eWZ5rgZGvrMM0T6b/2J75To9YZiq6ZajFZ9yt9BkJOOe1CAaeiLknb l8f+h5WfK5RyXMeOBoFgD1peigqKFiI0n76xExzC7fO3Sj6IMIGsAT57ya+9ZUPt50bb TARU1kq0qM7sI6V5naGro6xSPFq3B9r4UOiUgiN7bMbaLKlCh4nIpgrBOChs5CBiASds IqqA== X-Gm-Message-State: ALoCoQlVDsNhF3LluhO7zFtz4/b1vS4F9z7AqopkXcO6fXkYxWmCDkhfTrhWSiIBpd+tRAfcN89I X-Received: by 10.66.144.133 with SMTP id sm5mr28593768pab.5.1386247188066; Thu, 05 Dec 2013 04:39:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.25.42 with SMTP id z10ls776073qef.63.gmail; Thu, 05 Dec 2013 04:39:47 -0800 (PST) X-Received: by 10.58.156.106 with SMTP id wd10mr63294949veb.7.1386247187916; Thu, 05 Dec 2013 04:39:47 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id x1si5867505vdo.55.2013.12.05.04.39.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 04:39:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 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.170; Received: by mail-vc0-f170.google.com with SMTP id ht10so12972931vcb.15 for ; Thu, 05 Dec 2013 04:39:47 -0800 (PST) X-Received: by 10.52.230.102 with SMTP id sx6mr52722878vdc.15.1386247187671; Thu, 05 Dec 2013 04:39:47 -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 u4csp11813vcz; Thu, 5 Dec 2013 04:39:47 -0800 (PST) X-Received: by 10.152.22.201 with SMTP id g9mr7149219laf.27.1386247185747; Thu, 05 Dec 2013 04:39:45 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id bj6si5870350lbc.77.2013.12.05.04.39.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Dec 2013 04:39:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VoYDU-000723-Qx; Thu, 05 Dec 2013 12:39:40 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Matz , C Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 03/12] target-arm: A64: provide functions for accessing FPCR and FPSR Date: Thu, 5 Dec 2013 12:39:31 +0000 Message-Id: <1386247180-26994-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386247180-26994-1-git-send-email-peter.maydell@linaro.org> References: <1386247180-26994-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.170 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,