summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2002-06-01 17:39:46 +0000
committerbde <bde@FreeBSD.org>2002-06-01 17:39:46 +0000
commitdee070ee6ebd2cd6a3ee6cbb6a1b2ccbc675c27e (patch)
tree0877d24fee87fa10496985fc95f978bcbe49719d
parentacb72828eebaf8273141606122f43a400a0214b8 (diff)
downloadFreeBSD-src-dee070ee6ebd2cd6a3ee6cbb6a1b2ccbc675c27e.zip
FreeBSD-src-dee070ee6ebd2cd6a3ee6cbb6a1b2ccbc675c27e.tar.gz
Fixed the return value of fpsetmask(). The API requires inversion of the
mask on both input and output to fpsetmask(), but this was only done for input, so fpsetmask() returned the complement of the old mask (ANDed with the mask bitfield). PR: 38170 MFC after: 4 weeks
-rw-r--r--sys/amd64/include/floatingpoint.h3
-rw-r--r--sys/i386/include/floatingpoint.h3
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/amd64/include/floatingpoint.h b/sys/amd64/include/floatingpoint.h
index cea1691..56c781a 100644
--- a/sys/amd64/include/floatingpoint.h
+++ b/sys/amd64/include/floatingpoint.h
@@ -119,7 +119,8 @@ __fpsetreg(int _m, int _reg, int _fld, int _off)
#define fpgetmask() ((fp_except_t) \
((~__fpgetreg(FP_MSKS_REG) & FP_MSKS_FLD) >> FP_MSKS_OFF))
#define fpsetmask(m) ((fp_except_t) \
- (__fpsetreg(~(m), FP_MSKS_REG, FP_MSKS_FLD, FP_MSKS_OFF)))
+ (~__fpsetreg(~(m), FP_MSKS_REG, FP_MSKS_FLD, FP_MSKS_OFF)) & \
+ (FP_MSKS_FLD >> FP_MSKS_OFF))
#define fpgetsticky() ((fp_except_t) \
((__fpgetreg(FP_STKY_REG) & FP_STKY_FLD) >> FP_STKY_OFF))
#define fpresetsticky(m) ((fp_except_t) \
diff --git a/sys/i386/include/floatingpoint.h b/sys/i386/include/floatingpoint.h
index cea1691..56c781a 100644
--- a/sys/i386/include/floatingpoint.h
+++ b/sys/i386/include/floatingpoint.h
@@ -119,7 +119,8 @@ __fpsetreg(int _m, int _reg, int _fld, int _off)
#define fpgetmask() ((fp_except_t) \
((~__fpgetreg(FP_MSKS_REG) & FP_MSKS_FLD) >> FP_MSKS_OFF))
#define fpsetmask(m) ((fp_except_t) \
- (__fpsetreg(~(m), FP_MSKS_REG, FP_MSKS_FLD, FP_MSKS_OFF)))
+ (~__fpsetreg(~(m), FP_MSKS_REG, FP_MSKS_FLD, FP_MSKS_OFF)) & \
+ (FP_MSKS_FLD >> FP_MSKS_OFF))
#define fpgetsticky() ((fp_except_t) \
((__fpgetreg(FP_STKY_REG) & FP_STKY_FLD) >> FP_STKY_OFF))
#define fpresetsticky(m) ((fp_except_t) \
OpenPOWER on IntegriCloud