Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/m68k/fpe Fix botch in rev 1.28 that causes wrong re...
details: https://anonhg.NetBSD.org/src/rev/2947da4548e4
branches: trunk
changeset: 764965:2947da4548e4
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat May 14 16:17:55 2011 +0000
description:
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.
diffstat:
sys/arch/m68k/fpe/fpu_emulate.c | 41 ++++++++++++++++++++++++-----------------
1 files changed, 24 insertions(+), 17 deletions(-)
diffs (68 lines):
diff -r 567993a02710 -r 2947da4548e4 sys/arch/m68k/fpe/fpu_emulate.c
--- a/sys/arch/m68k/fpe/fpu_emulate.c Sat May 14 15:02:29 2011 +0000
+++ b/sys/arch/m68k/fpe/fpu_emulate.c Sat May 14 16:17:55 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_emulate.c,v 1.30 2009/03/14 15:36:09 dsl Exp $ */
+/* $NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.30 2009/03/14 15:36:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -909,27 +909,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",
Home |
Main Index |
Thread Index |
Old Index