qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH][PPC] mtfsf: fix FPSCR_VX and FPSCR_FEX computation
@ 2007-12-10  9:13 Aurelien Jarno
  2007-12-10 12:10 ` Jocelyn Mayer
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2007-12-10  9:13 UTC (permalink / raw)
  To: qemu-devel

Hi all,

The patch below fix the computation of FPSCR_VX and FPSCR_FEX when
using the mtfsf instruction. As stated in the PowerPC manual the mtfsf
instruction can't alter those bit, and thus it should always be 
computed.

Bye,
Aurelien

Index: target-ppc/op_helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-ppc/op_helper.c,v
retrieving revision 1.73
diff -u -d -p -r1.73 op_helper.c
--- target-ppc/op_helper.c	24 Nov 2007 02:03:55 -0000	1.73
+++ target-ppc/op_helper.c	10 Dec 2007 09:10:30 -0000
@@ -888,12 +888,16 @@ void do_store_fpscr (uint32_t mask)
     /* Update VX and FEX */
     if (fpscr_ix != 0)
         env->fpscr |= 1 << FPSCR_VX;
+    else
+        env->fpscr &= ~(1 << FPSCR_VX);
     if ((fpscr_ex & fpscr_eex) != 0) {
         env->fpscr |= 1 << FPSCR_FEX;
         env->exception_index = POWERPC_EXCP_PROGRAM;
         /* XXX: we should compute it properly */
         env->error_code = POWERPC_EXCP_FP;
     }
+    else
+        env->fpscr &= ~(1 << FPSCR_FEX);
     fpscr_set_rounding_mode();
 }
 #undef WORD0

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH][PPC] mtfsf: fix FPSCR_VX and FPSCR_FEX computation
  2007-12-10  9:13 [Qemu-devel] [PATCH][PPC] mtfsf: fix FPSCR_VX and FPSCR_FEX computation Aurelien Jarno
@ 2007-12-10 12:10 ` Jocelyn Mayer
  2008-01-23 15:20   ` Aurelien Jarno
  0 siblings, 1 reply; 3+ messages in thread
From: Jocelyn Mayer @ 2007-12-10 12:10 UTC (permalink / raw)
  To: qemu-devel


On Mon, 2007-12-10 at 10:13 +0100, Aurelien Jarno wrote:
> Hi all,

Hi,

> The patch below fix the computation of FPSCR_VX and FPSCR_FEX when
> using the mtfsf instruction. As stated in the PowerPC manual the mtfsf
> instruction can't alter those bit, and thus it should always be 
> computed.

You're right, the values are not computed properly.
I'll commit your fix.


> Index: target-ppc/op_helper.c
> ===================================================================
> RCS file: /sources/qemu/qemu/target-ppc/op_helper.c,v
> retrieving revision 1.73
> diff -u -d -p -r1.73 op_helper.c
> --- target-ppc/op_helper.c	24 Nov 2007 02:03:55 -0000	1.73
> +++ target-ppc/op_helper.c	10 Dec 2007 09:10:30 -0000
> @@ -888,12 +888,16 @@ void do_store_fpscr (uint32_t mask)
>      /* Update VX and FEX */
>      if (fpscr_ix != 0)
>          env->fpscr |= 1 << FPSCR_VX;
> +    else
> +        env->fpscr &= ~(1 << FPSCR_VX);
>      if ((fpscr_ex & fpscr_eex) != 0) {
>          env->fpscr |= 1 << FPSCR_FEX;
>          env->exception_index = POWERPC_EXCP_PROGRAM;
>          /* XXX: we should compute it properly */
>          env->error_code = POWERPC_EXCP_FP;
>      }
> +    else
> +        env->fpscr &= ~(1 << FPSCR_FEX);
>      fpscr_set_rounding_mode();
>  }
>  #undef WORD0

-- 
Jocelyn Mayer <l_indien@magic.fr>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH][PPC] mtfsf: fix FPSCR_VX and FPSCR_FEX computation
  2007-12-10 12:10 ` Jocelyn Mayer
@ 2008-01-23 15:20   ` Aurelien Jarno
  0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2008-01-23 15:20 UTC (permalink / raw)
  To: l_indien, qemu-devel

Jocelyn Mayer a écrit :
> On Mon, 2007-12-10 at 10:13 +0100, Aurelien Jarno wrote:
>> Hi all,
> 
> Hi,
> 
>> The patch below fix the computation of FPSCR_VX and FPSCR_FEX when
>> using the mtfsf instruction. As stated in the PowerPC manual the mtfsf
>> instruction can't alter those bit, and thus it should always be 
>> computed.
> 
> You're right, the values are not computed properly.
> I'll commit your fix.
> 

Any news on that?

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-23 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-10  9:13 [Qemu-devel] [PATCH][PPC] mtfsf: fix FPSCR_VX and FPSCR_FEX computation Aurelien Jarno
2007-12-10 12:10 ` Jocelyn Mayer
2008-01-23 15:20   ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).