1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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.
This commit is contained in:
Marcel Moolenaar 2003-10-22 09:00:07 +00:00
parent 552b83803a
commit b32428bbc5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121332
2 changed files with 3 additions and 3 deletions

View File

@ -36,5 +36,5 @@ fpgetmask(void)
u_int64_t fpsr;
__asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr));
return (~fpsr & 0x3f);
return (~fpsr & 0x3d);
}

View File

@ -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);
}