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]

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


Hi!

On Thu,  5 Apr 2012 10:37:48 +0900, Nobuhiro Iwamatsu <iwamatsu@nigauri.org> wrote:
> 	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.

> 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
> @@ -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;
>  }

Why is this needed?  It seems that I can't find it neither in the SH-4A
Software Manual nor in the SH7785 Hardware Manual.


GrÃÃe,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


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