Author: jhibbits
Date: Wed Jan 16 03:52:43 2019
New Revision: 343078
URL: https://svnweb.freebsd.org/changeset/base/343078

Log:
  powerpc: Fix FPU fsqrt emulation special case results
  
  If fsqrts is emulated with +INF as its argument, the 0 return value causes a
  NULL pointer dereference, panicking the system.  Follow the PowerISA and
  return +INF with no FP exception.
  
  MFC after:    1 week

Modified:
  head/sys/powerpc/fpu/fpu_sqrt.c

Modified: head/sys/powerpc/fpu/fpu_sqrt.c
==============================================================================
--- head/sys/powerpc/fpu/fpu_sqrt.c     Wed Jan 16 03:46:27 2019        
(r343077)
+++ head/sys/powerpc/fpu/fpu_sqrt.c     Wed Jan 16 03:52:43 2019        
(r343078)
@@ -226,12 +226,12 @@ fpu_sqrt(struct fpemu *fe)
                return (x);
        }
        if (x->fp_sign) {
+               fe->fe_cx |= FPSCR_VXSQRT;
                return (fpu_newnan(fe));
        }
        if (ISINF(x)) {
-               fe->fe_cx |= FPSCR_VXSQRT;
-               DUMPFPN(FPE_REG, 0);
-               return (0);
+               DUMPFPN(FPE_REG, x);
+               return (x);
        }
 
        /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to