Patchwork [2/6] ARM: Expose vfp_get_fpscr() and vfp_set_fpscr() to C code

login
register
mail settings
Submitter Peter Maydell
Date Nov. 24, 2010, 3:20 p.m.
Message ID <1290612008-18693-3-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/72897/
State New
Headers show

Comments

Peter Maydell - Nov. 24, 2010, 3:20 p.m.
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 <peter.maydell@linaro.org>
---
 target-arm/cpu.h    |    4 ++++
 target-arm/helper.c |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
Nathan Froyd - Nov. 29, 2010, 7:07 p.m.
On Wed, Nov 24, 2010 at 03:20:04PM +0000, Peter Maydell wrote:
> 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 <peter.maydell@linaro.org>

Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>

-Nathan

Patch

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) \