Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2019 03:52:43 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343078 - head/sys/powerpc/fpu
Message-ID:  <201901160352.x0G3qh2Y037017@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901160352.x0G3qh2Y037017>