Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/powerpc/gen Update FPSCR_FX consistently per t...
details: https://anonhg.NetBSD.org/src/rev/8eaf60c2694b
branches: trunk
changeset: 565348:8eaf60c2694b
user: matt <matt%NetBSD.org@localhost>
date: Sun Apr 04 19:54:05 2004 +0000
description:
Update FPSCR_FX consistently per the Programming Environment Manual. So
if any sticky bit is set, FPSCR_FX should be set. If no sticky bits are
set, then FPSCR_FX should be clear.
diffstat:
lib/libc/arch/powerpc/gen/fpsetsticky.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (40 lines):
diff -r c8e8a8c3d12b -r 8eaf60c2694b lib/libc/arch/powerpc/gen/fpsetsticky.c
--- a/lib/libc/arch/powerpc/gen/fpsetsticky.c Sun Apr 04 19:31:19 2004 +0000
+++ b/lib/libc/arch/powerpc/gen/fpsetsticky.c Sun Apr 04 19:54:05 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetsticky.c,v 1.5 2004/04/04 19:31:19 matt Exp $ */
+/* $NetBSD: fpsetsticky.c,v 1.6 2004/04/04 19:54:05 matt Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -63,18 +63,26 @@
__asm__ __volatile("mffs %0" : "=f"(fpscr));
old = ((uint32_t)fpscr & STICKYBITS) >> STICKYSHFT;
/*
- * FPSCR_VX (aka FP_X_INV) is not a sticky bit but a summary
- * of the all the FPSCR_VX* sticky bits. So FP_X_INV is cleared
+ * FPSCR_VX (aka FP_X_INV) is not a sticky bit but a summary of the
+ * all the FPSCR_VX* sticky bits. So when FP_X_INV is cleared then
* clear all of those bits, likewise when it's set, set them all.
*/
if ((mask & FP_X_INV) == 0)
fpscr &= ~INVBITS;
else
fpscr |= INVBITS;
- if (mask == 0)
- fpscr &= ~FPSCR_FX;
fpscr &= ~STICKYBITS;
fpscr |= ((uint32_t)mask << STICKYSHFT) & STICKYBITS;
+ /*
+ * Make FPSCR_FX reflect the presence of a set sticky bit (or not).
+ */
+ if (fpscr & (STICKYBITS|INVBITS))
+ fpscr |= FPSCR_FX;
+ else
+ fpscr &= ~FPSCR_FX;
+ /*
+ * Write back the fpscr.
+ */
__asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr));
return (old);
}
Home |
Main Index |
Thread Index |
Old Index