From c617dd785dde62eb0862c576f679fdd43dcd3a9a Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Wed, 14 Jan 2009 12:49:24 +0000 Subject: libm_sh: Re-added sh specific files erroneously removed recently, and moved under a better folder. Signed-off-by: Carmelo Amoroso --- libm/sh/Makefile.arch | 18 ++++++++++++++++++ libm/sh/feholdexcpt.c | 30 ++++++++++++++++++++++++++++++ libm/sh/fesetenv.c | 27 +++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 libm/sh/Makefile.arch create mode 100644 libm/sh/feholdexcpt.c create mode 100644 libm/sh/fesetenv.c (limited to 'libm') 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 +#include + +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 +#include + +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) -- cgit v1.2.3