This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/4 v2] [SH/SH4]: Set fpcsr register which read again


	2012-04-04  Nobuhiro Iwamatsu  <iwamatsu@nigauri.org>

	* sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Set fpscr register which
	read again.
	* sysdeps/sh/sh4/fpu/ftestexcept.c: Likewise.
---
 sysdeps/sh/sh4/fpu/fegetenv.c    |    6 +++++-
 sysdeps/sh/sh4/fpu/ftestexcept.c |    3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sysdeps/sh/sh4/fpu/fegetenv.c b/sysdeps/sh/sh4/fpu/fegetenv.c
index 68687dc..49e499f 100644
--- a/sysdeps/sh/sh4/fpu/fegetenv.c
+++ b/sysdeps/sh/sh4/fpu/fegetenv.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment.
-   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,10 @@ fegetenv (fenv_t *envp)
 {
   unsigned long int temp;
   _FPU_GETCW (temp);
+  /* When read fpscr, this was initialized.
+	 We need to rewrite value of temp. */
+  _FPU_SETCW (temp);
+
   envp->__fpscr = temp;
 
   return 0;
diff --git a/sysdeps/sh/sh4/fpu/ftestexcept.c b/sysdeps/sh/sh4/fpu/ftestexcept.c
index 9e0bfc5..c2e1772 100644
--- a/sysdeps/sh/sh4/fpu/ftestexcept.c
+++ b/sysdeps/sh/sh4/fpu/ftestexcept.c
@@ -26,6 +26,9 @@ fetestexcept (int excepts)
 
   /* Get current exceptions.  */
   _FPU_GETCW (temp);
+  /* When read fpscr, this was initialized.
+     We need to rewrite value of temp. */
+  _FPU_SETCW (temp);
 
   return temp & excepts & FE_ALL_EXCEPT;
 }
-- 
1.7.9.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]