summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2018-07-09 16:20:33 +0000
committerbluhm <bluhm@openbsd.org>2018-07-09 16:20:33 +0000
commit6d6884da9552eaecc9b650abb69bf999719c27cd (patch)
treec949388cb29984483491c3fa7f742019fdbcc866
parentRename the THESETS variable to ALLSETS because it holds the list (diff)
downloadwireguard-openbsd-6d6884da9552eaecc9b650abb69bf999719c27cd.tar.xz
wireguard-openbsd-6d6884da9552eaecc9b650abb69bf999719c27cd.zip
Clear the part of fenv that is modified by old AMD Opteron during
process startup. from guenther@
-rw-r--r--regress/lib/libm/fenv/fenv.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/regress/lib/libm/fenv/fenv.c b/regress/lib/libm/fenv/fenv.c
index 038b2f9ef19..4de4d86fd22 100644
--- a/regress/lib/libm/fenv/fenv.c
+++ b/regress/lib/libm/fenv/fenv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fenv.c,v 1.3 2017/08/07 20:56:46 bluhm Exp $ */
+/* $OpenBSD: fenv.c,v 1.4 2018/07/09 16:20:33 bluhm Exp $ */
/*-
* Copyright (c) 2004 David Schultz <das@FreeBSD.org>
@@ -41,6 +41,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <machine/fpu.h>
/*
* Implementations are permitted to define additional exception flags
@@ -132,6 +133,10 @@ test_dfl_env(void)
fenv_t env;
fegetenv(&env);
+#ifdef __amd64
+ /* Some early amd64 CPUs set fip+fdp for non-x87 instructions */
+ memset(&env.__x87.__others[0], 0, 14);
+#endif /* __amd64 */
assert(memcmp(&env, FE_DFL_ENV, sizeof(env)) == 0);
#endif
assert(fetestexcept(FE_ALL_EXCEPT) == 0);
@@ -424,7 +429,7 @@ test_feholdupdate(void)
* We don't want to cause a fatal exception in
* the child until the second pass, so we can
* check other properties of feupdateenv().
- */
+ */
if (pass == 1)
assert((feenableexcept(except) &
ALL_STD_EXCEPT) == 0);