From patchwork Wed Nov 24 15:20:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 72897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C9718B7043 for ; Thu, 25 Nov 2010 02:23:15 +1100 (EST) Received: from localhost ([127.0.0.1]:51693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLHBh-00089r-0W for incoming@patchwork.ozlabs.org; Wed, 24 Nov 2010 10:23:13 -0500 Received: from [140.186.70.92] (port=34712 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLH8o-0006w4-MZ for qemu-devel@nongnu.org; Wed, 24 Nov 2010 10:20:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLH8l-00047O-B3 for qemu-devel@nongnu.org; Wed, 24 Nov 2010 10:20:14 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:16641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLH8l-00045l-1M for qemu-devel@nongnu.org; Wed, 24 Nov 2010 10:20:11 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PLH8i-0004rz-Db for qemu-devel@nongnu.org; Wed, 24 Nov 2010 15:20:08 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 24 Nov 2010 15:20:04 +0000 Message-Id: <1290612008-18693-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1290612008-18693-1-git-send-email-peter.maydell@linaro.org> References: <1290612008-18693-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 2/6] ARM: Expose vfp_get_fpscr() and vfp_set_fpscr() to C code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Expose the vfp_get_fpscr() and vfp_set_fpscr() functions to C code as well as generated code, so we can use them to read and write the FPSCR when saving and restoring VFP registers across signal handlers in linux-user mode. Signed-off-by: Peter Maydell Reviewed-by: Nathan Froyd --- target-arm/cpu.h | 4 ++++ target-arm/helper.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index b87c605..0fb3f5c 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -302,6 +302,10 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) } } +/* Return the current FPSCR value. */ +uint32_t vfp_get_fpscr(CPUARMState *env); +void vfp_set_fpscr(CPUARMState *env, uint32_t val); + enum arm_cpu_mode { ARM_CPU_MODE_USR = 0x10, ARM_CPU_MODE_FIQ = 0x11, diff --git a/target-arm/helper.c b/target-arm/helper.c index 996d40d..b8dcdf7 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2245,6 +2245,11 @@ uint32_t HELPER(vfp_get_fpscr)(CPUState *env) return fpscr; } +uint32_t vfp_get_fpscr(CPUState *env) +{ + return HELPER(vfp_get_fpscr)(env); +} + /* Convert vfp exception flags to target form. */ static inline int vfp_exceptbits_to_host(int target_bits) { @@ -2301,6 +2306,11 @@ void HELPER(vfp_set_fpscr)(CPUState *env, uint32_t val) set_float_exception_flags(i, &env->vfp.fp_status); } +void vfp_set_fpscr(CPUState *env, uint32_t val) +{ + HELPER(vfp_set_fpscr)(env, val); +} + #define VFP_HELPER(name, p) HELPER(glue(glue(vfp_,name),p)) #define VFP_BINOP(name) \