Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/alpha/alpha Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/d61e69f5c964
branches:  netbsd-9
changeset: 964102:d61e69f5c964
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 02 12:38:07 2020 +0000

description:
Pull up following revision(s) (requested by thorpej in ticket #1071):

        sys/arch/alpha/alpha/fp_complete.c: revision 1.24

- compare_{le,lt)(): Use float64_{le,lt}_quiet() to avoid raising
exceptions on QNaNs.
- alpha_fp_interpret(): Instructions are 32-bits wide, so don't use a
uint64_t to contain them.
- alpha_fp_complete(): Operations on NaNs trap on Alpha, but the exception
summary reports INV (invalid operation) rather than SWC (software
completion) in this case.  So also interpret the instruction if INV
is set in the exception summary.  This will emulate operations on
NaN and correctly suppress FP traps for QNaNs.

This fixes bin/55633, which was caused by:
-> Input string "nanotime" is passed to awk's internal is_number().
-> strtod() interprets as "nan" and returns QNaN as the result.
-> Result compared against HUGE_VAL, blows up because cmptle is called
with a NaN operand, and the hardware doesn't care that it's quiet.

diffstat:

 sys/arch/alpha/alpha/fp_complete.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (61 lines):

diff -r 74e96cee7d91 -r d61e69f5c964 sys/arch/alpha/alpha/fp_complete.c
--- a/sys/arch/alpha/alpha/fp_complete.c        Wed Sep 02 12:34:55 2020 +0000
+++ b/sys/arch/alpha/alpha/fp_complete.c        Wed Sep 02 12:38:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $ */
+/* $NetBSD: fp_complete.c,v 1.23.4.1 2020/09/02 12:38:07 martin Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.23.4.1 2020/09/02 12:38:07 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -199,13 +199,13 @@
 static float64
 compare_lt(float64 a, float64 b)
 {
-       return CMP_RESULT(float64_lt(a, b));
+       return CMP_RESULT(float64_lt_quiet(a, b));
 }
 
 static float64
 compare_le(float64 a, float64 b)
 {
-       return CMP_RESULT(float64_le(a, b));
+       return CMP_RESULT(float64_le_quiet(a, b));
 }
 
 static float64
@@ -502,7 +502,7 @@
  */
 
 static void
-alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint64_t bits)
+alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint32_t bits)
 {
        s_float sfa, sfb, sfc;
        t_float tfa, tfb, tfc;
@@ -634,13 +634,15 @@
        pc = (alpha_instruction *)l->l_md.md_tf->tf_regs[FRAME_PC];
        trigger_pc = pc - 1;    /* for ALPHA_AMASK_PAT case */
        if (cpu_amask & ALPHA_AMASK_PAT) {
-               if (a0 & 1 || alpha_fp_sync_complete) {
+               /* SWC | INV */
+               if (a0 & 3 || alpha_fp_sync_complete) {
                        sig = alpha_fp_complete_at(trigger_pc, l, ucode);
                        goto done;
                }
        }
        *ucode = a0;
-       if (!(a0 & 1))
+       /* SWC | INV */
+       if (!(a0 & 3))
                return sig;
 /*
  * At this point we are somewhere in the trap shadow of one or more instruc-



Home | Main Index | Thread Index | Old Index