diff options
author | 2011-05-25 21:26:55 +0000 | |
---|---|---|
committer | 2011-05-25 21:26:55 +0000 | |
commit | 66e02d3fb8d64208b7e23ff761389558425df954 (patch) | |
tree | 6a543e4b8b66a4eece11117a2ee1720e73168c80 | |
parent | Set UX and SX in the system register early in boot. While not necessary on (diff) | |
download | wireguard-openbsd-66e02d3fb8d64208b7e23ff761389558425df954.tar.xz wireguard-openbsd-66e02d3fb8d64208b7e23ff761389558425df954.zip |
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.
-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); } |