From 03bab8d60f762d48a064ef975053c63000947f33 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sat, 9 Aug 2003 17:07:24 +0000 Subject: [PATCH] o There are 6 trap disable bits in ar.fpsr, not five. Even though we didn't provide a constant for one of them (non-IEEE denormal trap), in an attempt to not support it probably, it's not we are left with the lower 5 bits. o Properly mask the passed or returned fp_except_t. Not doing so causes instant core dumps by trying to write an invalid value to ar.fpsr. Now that we're masking, stop using exclusive-or to invert bits. This fixes the illegal instruction fault encountered when building mozilla. --- lib/libc/ia64/gen/fpgetmask.c | 2 +- lib/libc/ia64/gen/fpsetmask.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/ia64/gen/fpgetmask.c b/lib/libc/ia64/gen/fpgetmask.c index f3beea81081d..2c4cadf6d0dd 100644 --- a/lib/libc/ia64/gen/fpgetmask.c +++ b/lib/libc/ia64/gen/fpgetmask.c @@ -36,5 +36,5 @@ fpgetmask(void) u_int64_t fpsr; __asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr)); - return (fpsr & 0x1f) ^ 0x1f; + return (~fpsr & 0x3f); } diff --git a/lib/libc/ia64/gen/fpsetmask.c b/lib/libc/ia64/gen/fpsetmask.c index c69dccbf1b19..be4d8b4f67a8 100644 --- a/lib/libc/ia64/gen/fpsetmask.c +++ b/lib/libc/ia64/gen/fpsetmask.c @@ -37,8 +37,8 @@ fpsetmask(fp_except_t mask) u_int64_t oldmask; __asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr)); - oldmask = (fpsr & 0x1f) ^ 0x1f; - fpsr = (fpsr & ~0x1f) | (mask ^ 0x1f); + oldmask = ~fpsr & 0x3f; + fpsr = (fpsr & ~0x3f) | (~mask & 0x3f); __asm __volatile("mov ar.fpsr=%0" :: "r" (fpsr)); - return oldmask; + return (oldmask); }