diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2011-05-25 21:26:56 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2011-05-25 21:26:56 +0000 |
commit | ddbd213814969b4db768a9b4f68fdd531b82829e (patch) | |
tree | 2cfc64fe6de69c7766b58604cffdfa47dd8555a0 /lib | |
parent | 9e363f9da59a23bb25eec4cbc9ccc02d9bd5f61c (diff) |
On PowerPC we cannot manipulate FPSCR[VX]--it's a summary of all
the invalid exception bits, as described in Section 3.3.6.1.1 of
PowerPC Architecture Programming Environments Manual.
A proper way to cause an invalid operation exception is to set
FPSCR[VXSOFT]. Similarly, we clear all the FPSCR[VX*] bits otherwise.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/powerpc/gen/fpsetsticky.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/arch/powerpc/gen/fpsetsticky.c b/lib/libc/arch/powerpc/gen/fpsetsticky.c index b881895ed05..08278fd2585 100644 --- a/lib/libc/arch/powerpc/gen/fpsetsticky.c +++ b/lib/libc/arch/powerpc/gen/fpsetsticky.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpsetsticky.c,v 1.3 2008/06/26 05:42:05 ray Exp $ */ +/* $OpenBSD: fpsetsticky.c,v 1.4 2011/05/25 21:26:55 martynas Exp $ */ /* $NetBSD: fpsetsticky.c,v 1.1 1999/07/07 01:55:08 danw Exp $ */ /* @@ -42,7 +42,11 @@ fpsetsticky(mask) __asm__ __volatile("mffs %0" : "=f"(fpscr)); old = (fpscr >> 25) & 0x1f; - fpscr = (fpscr & 0xc1ffffffULL) | (mask << 25); + fpscr = (fpscr & 0xe1ffffffULL) | ((mask & 0xf) << 25); + if (mask & FP_X_INV) + fpscr |= 0x400; + else + fpscr &= 0xfe07f8ffULL; __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr)); return (old); } |