-/* $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>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <machine/fpu.h>
/*
* Implementations are permitted to define additional exception flags
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);
* 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);