Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/fpu Fix logic for FPSCR[FEX].



details:   https://anonhg.NetBSD.org/src/rev/84af4c8ba40f
branches:  trunk
changeset: 369745:84af4c8ba40f
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Aug 30 10:48:31 2022 +0000

description:
Fix logic for FPSCR[FEX].

It is logical OR (similar to FPSCR[VX]) of raised exception bits for
enabled exceptions.

diffstat:

 sys/arch/powerpc/fpu/fpu_emu.c |  13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r a6ca20aa464b -r 84af4c8ba40f sys/arch/powerpc/fpu/fpu_emu.c
--- a/sys/arch/powerpc/fpu/fpu_emu.c    Tue Aug 30 10:43:38 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_emu.c    Tue Aug 30 10:48:31 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emu.c,v 1.37 2022/08/30 10:43:38 rin Exp $ */
+/*     $NetBSD: fpu_emu.c,v 1.38 2022/08/30 10:48:31 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.37 2022/08/30 10:43:38 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.38 2022/08/30 10:48:31 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -783,12 +783,6 @@
        cx = fe->fe_cx;
        fsr = fe->fe_fpscr & ~(FPSCR_FEX|FPSCR_VX);
        if (cx != 0) {
-               if (cx & FPSR_INV)
-                       cx |= FPSCR_VX;
-               mask = fsr & FPSR_EX;
-               mask <<= (25-3);
-               if (cx & mask) 
-                       fsr |= FPSCR_FEX;
                if (cx & FPSCR_FPRF) {
                        /* Need to replace CC */
                        fsr &= ~FPSCR_FPRF;
@@ -798,6 +792,9 @@
        }
        if (fsr & FPSR_INV)
                fsr |= FPSCR_VX;
+       mask = (fsr & FPSR_EX) << (25 - 3);
+       if (fsr & mask)
+               fsr |= FPSCR_FEX;
        if (mtfsf == 0 && ((fsr ^ fe->fe_fpscr) & FPSR_EX_MSK))
                fsr |= FPSCR_FX;
 



Home | Main Index | Thread Index | Old Index