summaryrefslogtreecommitdiff
path: root/libm/sh/sh4
diff options
context:
space:
mode:
Diffstat (limited to 'libm/sh/sh4')
-rw-r--r--libm/sh/sh4/Makefile.arch22
-rw-r--r--libm/sh/sh4/feholdexcpt.c29
-rw-r--r--libm/sh/sh4/fesetenv.c26
3 files changed, 77 insertions, 0 deletions
diff --git a/libm/sh/sh4/Makefile.arch b/libm/sh/sh4/Makefile.arch
new file mode 100644
index 000000000..122d84da2
--- /dev/null
+++ b/libm/sh/sh4/Makefile.arch
@@ -0,0 +1,22 @@
+# Makefile for uClibc
+#
+# Copyright (c) 2007, 2010 STMicroelectronics Ltd
+#
+# Author(s): Carmelo Amoroso <carmelo.amoroso@st.com>
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+ifeq ($(UCLIBC_HAS_FENV),y)
+libm_ARCH_SRC:=$(wildcard $(libm_SUBARCH_DIR)/*.c)
+libm_ARCH_OBJ:=$(patsubst $(libm_SUBARCH_DIR)/%.c,$(libm_SUBARCH_OUT)/%.o,$(libm_ARCH_SRC))
+endif
+
+libm_ARCH_OBJS:=$(libm_ARCH_OBJ)
+
+ifeq ($(DOPIC),y)
+libm-a-y+=$(libm_ARCH_OBJS:.o=.os)
+else
+libm-a-y+=$(libm_ARCH_OBJS)
+endif
+libm-so-y+=$(libm_ARCH_OBJS:.o=.os)
+
diff --git a/libm/sh/sh4/feholdexcpt.c b/libm/sh/sh4/feholdexcpt.c
new file mode 100644
index 000000000..70b51e8dd
--- /dev/null
+++ b/libm/sh/sh4/feholdexcpt.c
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (c) 2007 STMicroelectronics Ltd
+ * Filippo Arcidiacono (filippo.arcidiacono@st.com)
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ * Taken from glibc 2.6
+ *
+ */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ unsigned long int temp;
+
+ /* Store the environment. */
+ _FPU_GETCW (temp);
+ envp->__fpscr = temp;
+
+ /* Now set all exceptions to non-stop. */
+ temp &= ~FE_ALL_EXCEPT;
+ _FPU_SETCW (temp);
+
+ return 1;
+}
diff --git a/libm/sh/sh4/fesetenv.c b/libm/sh/sh4/fesetenv.c
new file mode 100644
index 000000000..c5cfc1d51
--- /dev/null
+++ b/libm/sh/sh4/fesetenv.c
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (c) 2007 STMicroelectronics Ltd
+ * Filippo Arcidiacono (filippo.arcidiacono@st.com)
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ * Taken from glibc 2.6
+ *
+ */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fesetenv (const fenv_t *envp)
+{
+ if (envp == FE_DFL_ENV)
+ _FPU_SETCW (_FPU_DEFAULT);
+ else
+ {
+ unsigned long int temp = envp->__fpscr;
+ _FPU_SETCW (temp);
+ }
+ return 0;
+}