about summary refs log tree commit diff
path: root/src/fenv/x86_64
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2013-08-18 20:08:18 +0000
committerSzabolcs Nagy <nsz@port70.net>2013-08-18 20:08:18 +0000
commita6b0170a7f51fdea9beec57ae794221290af232b (patch)
tree22651ba3480fc272933133af780e6beb10ab2d3d /src/fenv/x86_64
parentd8764bf84022397ff9d22310f78fcd78d801e2bf (diff)
downloadmusl-a6b0170a7f51fdea9beec57ae794221290af232b.tar.gz
musl-a6b0170a7f51fdea9beec57ae794221290af232b.tar.xz
musl-a6b0170a7f51fdea9beec57ae794221290af232b.zip
fix fenv exception functions to mask their argument
fesetround.c is a wrapper to do the arch independent argument
check (on archs where rounding mode is not stored in 2 bits
__fesetround still has to check its arguments)

on powerpc fe*except functions do not accept the extra invalid
flags of its fpscr register

the useless FENV_ACCESS pragma was removed from feupdateenv
Diffstat (limited to 'src/fenv/x86_64')
-rw-r--r--src/fenv/x86_64/fenv.s11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/fenv/x86_64/fenv.s b/src/fenv/x86_64/fenv.s
index dda6b61a..6aaf25eb 100644
--- a/src/fenv/x86_64/fenv.s
+++ b/src/fenv/x86_64/fenv.s
@@ -3,6 +3,7 @@
 feclearexcept:
 		# maintain exceptions in the sse mxcsr, clear x87 exceptions
 	mov %edi,%ecx
+	and $0x3f,%ecx
 	fnstsw %ax
 	test %eax,%ecx
 	jz 1f
@@ -20,16 +21,17 @@ feclearexcept:
 
 .global feraiseexcept
 .type feraiseexcept,@function
-feraiseexcept:	
+feraiseexcept:
+	and $0x3f,%edi
 	stmxcsr -8(%rsp)
 	or %edi,-8(%rsp)
 	ldmxcsr -8(%rsp)
 	xor %eax,%eax
 	ret
 
-.global fesetround
-.type fesetround,@function
-fesetround:
+.global __fesetround
+.type __fesetround,@function
+__fesetround:
 	push %rax
 	xor %eax,%eax
 	mov %edi,%ecx
@@ -85,6 +87,7 @@ fesetenv:
 .global fetestexcept
 .type fetestexcept,@function
 fetestexcept:
+	and $0x3f,%edi
 	push %rax
 	stmxcsr (%rsp)
 	pop %rsi