Module Name:    src
Committed By:   bouyer
Date:           Sat Jun 18 16:26:58 UTC 2011

Modified Files:
        src/sys/arch/m68k/fpe [netbsd-5]: fpu_emulate.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1626):
        sys/arch/m68k/fpe/fpu_emulate.c: revision 1.31
Fix botch in rev 1.28 that causes wrong results of fcmp and ftst in FPE.
fpu_upd_fpsr() should be called even in discard_result case if an emulated
instruction gets proper result without signal.
Fixes weird behavior of awk(1) seen on /etc/rc.d/postfix on XM6i and
TME emulating sun3 without 68881.
Should be pulled up to all netbsd-4 and netbsd-5 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.27.54.1 -r1.27.54.2 src/sys/arch/m68k/fpe/fpu_emulate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.27.54.1 src/sys/arch/m68k/fpe/fpu_emulate.c:1.27.54.2
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.27.54.1	Mon Jan 26 00:24:55 2009
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Sat Jun 18 16:26:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.27.54.1 2009/01/26 00:24:55 snj Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.27.54.2 2011/06/18 16:26:58 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.27.54.1 2009/01/26 00:24:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.27.54.2 2011/06/18 16:26:58 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -922,27 +922,34 @@
     if (res == NULL)
 	sig = SIGILL;
 
-    if (!discard_result && sig == 0) {
-	fpu_implode(fe, res, FTYPE_EXT, &fpregs[regnum * 3]);
+    if (sig == 0) {
+	if (!discard_result)
+	    fpu_implode(fe, res, FTYPE_EXT, &fpregs[regnum * 3]);
 
 	/* update fpsr according to the result of operation */
 	fpu_upd_fpsr(fe, res);
 #if DEBUG_FPE
-	printf("fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n",
-	       fpregs[regnum*3], fpregs[regnum*3+1],
-	       fpregs[regnum*3+2], regnum);
-    } else if (sig == 0) {
-	static const char *class_name[] =
-	    { "SNAN", "QNAN", "ZERO", "NUM", "INF" };
-	printf("fpu_emul_arith: result(%s,%c,%d,%08x,%08x,%08x) discarded\n",
-	       class_name[res->fp_class + 2],
-	       res->fp_sign ? '-' : '+', res->fp_exp,
-	       res->fp_mant[0], res->fp_mant[1],
-	       res->fp_mant[2]);
-    } else {
-	printf("fpu_emul_arith: received signal %d\n", sig);
+	if (!discard_result) {
+	    printf("fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n",
+		fpregs[regnum*3], fpregs[regnum*3+1],
+		fpregs[regnum*3+2], regnum);
+	} else {
+	    static const char *class_name[] =
+		{ "SNAN", "QNAN", "ZERO", "NUM", "INF" };
+	    printf("fpu_emul_arith: result(%s,%c,%d,%08x,%08x,%08x)"
+		" discarded\n",
+		class_name[res->fp_class + 2],
+		res->fp_sign ? '-' : '+', res->fp_exp,
+		res->fp_mant[0], res->fp_mant[1],
+		res->fp_mant[2]);
+	}
 #endif
     }
+#if DEBUG_FPE
+    else {
+	printf("fpu_emul_arith: received signal %d\n", sig);
+    }
+#endif
 
 #if DEBUG_FPE
     printf("fpu_emul_arith: FPSR = %08x, FPCR = %08x\n",

Reply via email to