Commit 5567025f5352b7177f7040f40c200c6a66aa1cd2

Authored by aurel32
1 parent 0badc1ee

mtfsf: fix FPSCR_VX and FPSCR_FEX computation

The patch below fixes 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.

Acked by Jocelyn Mayer.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4034 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 0 deletions
target-ppc/op_helper.c
@@ -888,12 +888,16 @@ void do_store_fpscr (uint32_t mask) @@ -888,12 +888,16 @@ void do_store_fpscr (uint32_t mask)
888 /* Update VX and FEX */ 888 /* Update VX and FEX */
889 if (fpscr_ix != 0) 889 if (fpscr_ix != 0)
890 env->fpscr |= 1 << FPSCR_VX; 890 env->fpscr |= 1 << FPSCR_VX;
  891 + else
  892 + env->fpscr &= ~(1 << FPSCR_VX);
891 if ((fpscr_ex & fpscr_eex) != 0) { 893 if ((fpscr_ex & fpscr_eex) != 0) {
892 env->fpscr |= 1 << FPSCR_FEX; 894 env->fpscr |= 1 << FPSCR_FEX;
893 env->exception_index = POWERPC_EXCP_PROGRAM; 895 env->exception_index = POWERPC_EXCP_PROGRAM;
894 /* XXX: we should compute it properly */ 896 /* XXX: we should compute it properly */
895 env->error_code = POWERPC_EXCP_FP; 897 env->error_code = POWERPC_EXCP_FP;
896 } 898 }
  899 + else
  900 + env->fpscr &= ~(1 << FPSCR_FEX);
897 fpscr_set_rounding_mode(); 901 fpscr_set_rounding_mode();
898 } 902 }
899 #undef WORD0 903 #undef WORD0