summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-03-13 21:42:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-03-13 21:42:34 +0000
commit96c565c1104af3a90de9a8ce502c56209bb4e68a (patch)
tree4b9bfce7816e6e22549f08ba0496e2ad30e57ad5 /lib
parent14e24e6dfa3e04b3ec4b2c1534a090ba2e286366 (diff)
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)
Diffstat (limited to 'lib')
-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