summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libm/sh/Makefile.arch18
-rw-r--r--libm/sh/feholdexcpt.c30
-rw-r--r--libm/sh/fesetenv.c27
3 files changed, 75 insertions, 0 deletions
diff --git a/libm/sh/Makefile.arch b/libm/sh/Makefile.arch
new file mode 100644
index 000000000..e0f4fe952
--- /dev/null
+++ b/libm/sh/Makefile.arch
@@ -0,0 +1,18 @@
+# Makefile for uClibc
+#
+# Copyright (c) 2007 STMicroelectronics Ltd
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+libm_ARCH_SRC:=$(wildcard $(libm_ARCH_fpu_DIR)/*.c)
+libm_ARCH_OBJ:=$(patsubst $(libm_ARCH_fpu_DIR)/%.c,$(libm_ARCH_fpu_OUT)/%.o,$(libm_ARCH_SRC))
+
+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/feholdexcpt.c b/libm/sh/feholdexcpt.c
new file mode 100644
index 000000000..1af79b31f
--- /dev/null
+++ b/libm/sh/feholdexcpt.c
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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;
+}
+libm_hidden_def (feholdexcept)
diff --git a/libm/sh/fesetenv.c b/libm/sh/fesetenv.c
new file mode 100644
index 000000000..9f9082cf3
--- /dev/null
+++ b/libm/sh/fesetenv.c
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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;
+}
+libm_hidden_def (fesetenv)