summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2007-03-13 21:42:33 +0000
committermiod <miod@openbsd.org>2007-03-13 21:42:33 +0000
commit6729ecde6aa85fcdeff9e9a93aceb09b0a0d9840 (patch)
treec40fb9d9eec9468c1d5c51937944397eba46cf30
parentNuke __HAVE_OLD_DISKLABEL code, this was never defined anyway. (diff)
downloadwireguard-openbsd-6729ecde6aa85fcdeff9e9a93aceb09b0a0d9840.tar.xz
wireguard-openbsd-6729ecde6aa85fcdeff9e9a93aceb09b0a0d9840.zip
Set the DN bit in the fpscr upon startup, to prevent faulting when loading
denormals. This is recommended by the manual, and is necessary for the gdb testsuite to pass; found by, discussed with, and ok kettenis@ (be sure to make includes before recompiling csu)
-rw-r--r--lib/csu/sh/crt0.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/csu/sh/crt0.c b/lib/csu/sh/crt0.c
index 01be7a702a5..6e08127090d 100644
--- a/lib/csu/sh/crt0.c
+++ b/lib/csu/sh/crt0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crt0.c,v 1.2 2007/03/02 06:11:54 miod Exp $ */
+/* $OpenBSD: crt0.c,v 1.3 2007/03/13 21:42:33 miod Exp $ */
/* $NetBSD: crt0.c,v 1.10 2004/08/26 21:16:41 thorpej Exp $ */
/*
@@ -40,6 +40,7 @@
#include <sys/param.h>
#include <machine/asm.h>
+#include <machine/fpu.h>
#include <stdlib.h>
static char *_strrchr(const char *, char);
@@ -81,6 +82,8 @@ ___start(int argc, char **argv, char **envp, void *ps_strings,
extern unsigned int __fpscr_values[2];
__set_fpscr(0);
+ __fpscr_values[0] |= FPSCR_DN;
+ __fpscr_values[1] |= FPSCR_DN;
__asm__ __volatile__ ("lds %0, fpscr" : : "r" (__fpscr_values[1]));
#endif