diff options
author | marcel <marcel@FreeBSD.org> | 2003-10-22 09:00:07 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-10-22 09:00:07 +0000 |
commit | e03bb881018e9b61df99d63b91b69897ff7be763 (patch) | |
tree | 4436214cd380a54a0d4681fb1c1e34fd30d2da6f /lib/libc | |
parent | c61cedd97752e28ce8905b150f22b28abce05def (diff) | |
download | FreeBSD-src-e03bb881018e9b61df99d63b91b69897ff7be763.zip FreeBSD-src-e03bb881018e9b61df99d63b91b69897ff7be763.tar.gz |
The FP status register allows for 6 traps to be masked. One of them,
the denormal/unnormal trap, is not a standard IEEE trap. We did
not exclude it from being returned by fpgetmask(), nor did we make
sure that fpsetmask() didn't clobber it. Since the non-IEEE trap
is not part of fp_except_t, users of ifpgetmask()/fpsetmask() would
be confronted with unexpected behaviour, one of which is a SIGFPE
for denormal/unnormal FP results.
This commit makes sure that we don't leak the denormal/unnormal mask
bit in fp_except_t and also that we don't clobber it.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/ia64/gen/fpgetmask.c | 2 | ||||
-rw-r--r-- | lib/libc/ia64/gen/fpsetmask.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/ia64/gen/fpgetmask.c b/lib/libc/ia64/gen/fpgetmask.c index 2c4cadf..ac166e2 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 & 0x3f); + return (~fpsr & 0x3d); } diff --git a/lib/libc/ia64/gen/fpsetmask.c b/lib/libc/ia64/gen/fpsetmask.c index be4d8b4..d959dc6 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 & 0x3f; - fpsr = (fpsr & ~0x3f) | (~mask & 0x3f); + oldmask = ~fpsr & 0x3d; + fpsr = (fpsr & ~0x3d) | (~mask & 0x3d); __asm __volatile("mov ar.fpsr=%0" :: "r" (fpsr)); return (oldmask); } |