Mask off the result of feenableexcept and fedisableexcept on x86.

These shouldn't return bits outside FE_ALL_EXCEPT.
This commit is contained in:
riastradh 2012-08-04 03:53:55 +00:00
parent efcf62f2ac
commit 3a4a1ac26a
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fenv.c,v 1.3 2010/08/01 06:34:38 taca Exp $ */
/* $NetBSD: fenv.c,v 1.4 2012/08/04 03:53:55 riastradh Exp $ */
/*-
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: fenv.c,v 1.3 2010/08/01 06:34:38 taca Exp $");
__RCSID("$NetBSD: fenv.c,v 1.4 2012/08/04 03:53:55 riastradh Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@ -472,7 +472,7 @@ feenableexcept(int mask)
__ldmxcsr(mxcsr);
}
return (~omask);
return (FE_ALL_EXCEPT & ~omask);
}
int
@ -496,7 +496,7 @@ fedisableexcept(int mask)
__ldmxcsr(mxcsr);
}
return (~omask);
return (FE_ALL_EXCEPT & ~omask);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: fenv.c,v 1.1 2010/07/31 21:47:53 joerg Exp $ */
/* $NetBSD: fenv.c,v 1.2 2012/08/04 03:53:56 riastradh Exp $ */
/*-
* Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: fenv.c,v 1.1 2010/07/31 21:47:53 joerg Exp $");
__RCSID("$NetBSD: fenv.c,v 1.2 2012/08/04 03:53:56 riastradh Exp $");
#include <assert.h>
#include <fenv.h>
@ -483,7 +483,7 @@ feenableexcept(int mask)
mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
__ldmxcsr(mxcsr);
return (~omask);
return (FE_ALL_EXCEPT & ~omask);
}
@ -505,7 +505,7 @@ fedisableexcept(int mask)
mxcsr |= mask << _SSE_EMASK_SHIFT;
__ldmxcsr(mxcsr);
return (~omask);
return (FE_ALL_EXCEPT & ~omask);
}
int