summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2005-05-02 08:32:09 +0000
committerDavid Schleef <ds@schleef.org>2005-05-02 08:32:09 +0000
commit83c2d5d15012e22f310067cf58d0b53abf527682 (patch)
treed01527252c963d48f88eb068f6e469dbac500e09
parent2c6c33f31dcabcb4a9632e8088b2c7bf68566edd (diff)
downloadliboil-83c2d5d15012e22f310067cf58d0b53abf527682.tar.gz
* configure.ac: Check for gettimeofday and sigaction. Define
LIBM for linking with libm. * liboil/Makefile.am: Fixes for win32 building * liboil/conv/Makefile.am: same * liboil/dct/idct8x8_i386.c: (fdct8x8s_s16_mmx): save ebx properly * liboil/liboilcpu.c: (oil_cpu_fault_check_enable), (oil_cpu_fault_check_disable): conditionally use sigaction * liboil/liboilfunction.c: (oil_class_register_impl), (oil_class_register_impl_full): Add function * liboil/liboilfunction.h: same * liboil/liboilprofile.c: (oil_profile_stamp_gtod): make use of gettimeofday conditional.
-rw-r--r--ChangeLog15
-rw-r--r--configure.ac6
-rw-r--r--liboil/Makefile.am10
-rw-r--r--liboil/conv/Makefile.am1
-rw-r--r--liboil/dct/idct8x8_i386.c8
-rw-r--r--liboil/liboilcpu.c11
-rw-r--r--liboil/liboilfunction.c28
-rw-r--r--liboil/liboilfunction.h3
-rw-r--r--liboil/liboilprofile.c10
9 files changed, 80 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index b7fc044..2b146ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-05-02 David Schleef <ds@schleef.org>
+
+ * configure.ac: Check for gettimeofday and sigaction. Define
+ LIBM for linking with libm.
+ * liboil/Makefile.am: Fixes for win32 building
+ * liboil/conv/Makefile.am: same
+ * liboil/dct/idct8x8_i386.c: (fdct8x8s_s16_mmx): save ebx properly
+ * liboil/liboilcpu.c: (oil_cpu_fault_check_enable),
+ (oil_cpu_fault_check_disable): conditionally use sigaction
+ * liboil/liboilfunction.c: (oil_class_register_impl),
+ (oil_class_register_impl_full): Add function
+ * liboil/liboilfunction.h: same
+ * liboil/liboilprofile.c: (oil_profile_stamp_gtod): make use
+ of gettimeofday conditional.
+
2005-04-30 David Schleef <ds@schleef.org>
* liboil/copy/Makefile.am: Some cool new implementations.
diff --git a/configure.ac b/configure.ac
index f37c6a4..ff63939 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,12 @@ AC_CHECK_LIB(m, lrintf,
AC_CHECK_HEADER(ieee754.h,
AC_DEFINE(HAVE_IEEE754_H, 1, [Define if ieee754.h exists]))
+AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([sigaction])
+
+LIBM="-lm"
+AC_SUBST(LIBM)
+
AS_COMPILER_FLAG(-Wall, LIBOIL_CFLAGS="$LIBOIL_CFLAGS -Wall")
if test "x$LIBOIL_CVS" = "xyes"
then
diff --git a/liboil/Makefile.am b/liboil/Makefile.am
index d5e2de9..51f234f 100644
--- a/liboil/Makefile.am
+++ b/liboil/Makefile.am
@@ -29,14 +29,17 @@ liboilfunctions_la_LIBADD = \
md5/libmd5.la \
simdpack/libsimdpack.la \
utf8/libutf8.la \
- -lm
+ $(LIBM)
+liboilfunctions_la_LDFLAGS = \
+ -no-undefined
liboiltmp1_la_SOURCES =
liboiltmp1_la_LDFLAGS = \
+ -no-undefined \
-export-symbols-regex 'oil_'
liboiltmp1_la_LIBADD = \
liboilfunctions.la \
- -lm
+ $(LIBM)
liboil_@LIBOIL_MAJORMINOR@_la_SOURCES = \
liboil.h \
@@ -56,9 +59,10 @@ liboil_@LIBOIL_MAJORMINOR@_la_SOURCES = \
liboilmarshal.c
liboil_@LIBOIL_MAJORMINOR@_la_LIBADD = \
liboilfunctions.la \
- -lm
+ $(LIBM)
liboil_@LIBOIL_MAJORMINOR@_la_CFLAGS = $(LIBOIL_CFLAGS)
liboil_@LIBOIL_MAJORMINOR@_la_LDFLAGS = \
+ -no-undefined \
-version-info $(LIBOIL_LIBVERSION) \
-export-symbols-regex '^oil_'
diff --git a/liboil/conv/Makefile.am b/liboil/conv/Makefile.am
index 7bb3f4b..eee4a93 100644
--- a/liboil/conv/Makefile.am
+++ b/liboil/conv/Makefile.am
@@ -34,6 +34,5 @@ libconv_la_SOURCES = \
$(powerpc_sources) \
$(i386_sources)
libconv_la_CFLAGS = $(LIBOIL_CFLAGS)
-libconv_la_LDFLAGS = -lm
libconv_la_LIBADD = $(opt_libs)
diff --git a/liboil/dct/idct8x8_i386.c b/liboil/dct/idct8x8_i386.c
index c1d79e9..191e485 100644
--- a/liboil/dct/idct8x8_i386.c
+++ b/liboil/dct/idct8x8_i386.c
@@ -432,10 +432,10 @@ static void
fdct8x8s_s16_mmx (uint16_t *dest, int dstr, uint16_t *src, int sstr)
{
int32_t tmp[32];
+ int32_t save_ebx;
asm volatile (
- /* Note: this asm is unclean with %ebx, but it's not an issue
- * in this particular case. */
+ " movl %%ebx, %6 \n"
/* first half */
" movl %1, %%eax \n" // src
" movl %3, %%ebx \n" // sstr
@@ -731,11 +731,11 @@ fdct8x8s_s16_mmx (uint16_t *dest, int dstr, uint16_t *src, int sstr)
LOOP
" emms \n"
+ " movl %6, %%ebx \n"
:
- : "m" (dest), "m" (src), "m" (dstr), "m" (sstr), "r" (tmp), "r" (dct_mmx_constants)
+ : "m" (dest), "m" (src), "m" (dstr), "m" (sstr), "r" (tmp), "r" (dct_mmx_constants), "m" (save_ebx)
: "eax", "ecx", "edx");
}
OIL_DEFINE_IMPL_FULL (fdct8x8s_s16_mmx, fdct8x8s_s16, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_SSE);
-
diff --git a/liboil/liboilcpu.c b/liboil/liboilcpu.c
index dcf53e6..95d3303 100644
--- a/liboil/liboilcpu.c
+++ b/liboil/liboilcpu.c
@@ -333,8 +333,12 @@ _strndup (const char *s, int n)
#endif
static jmp_buf jump_env;
+#ifdef HAVE_SIGACTION
static struct sigaction action;
static struct sigaction oldaction;
+#else
+static void * oldhandler;
+#endif
static int in_try_block;
static void
@@ -350,9 +354,12 @@ illegal_instruction_handler (int num)
void
oil_cpu_fault_check_enable (void)
{
+#ifdef HAVE_SIGACTION
memset (&action, 0, sizeof(action));
action.sa_handler = &illegal_instruction_handler;
sigaction (SIGILL, &action, &oldaction);
+#endif
+ signal (SIGILL, illegal_instruction_handler);
in_try_block = 0;
}
@@ -374,6 +381,10 @@ oil_cpu_fault_check_try (void (*func) (void *), void *priv)
void
oil_cpu_fault_check_disable (void)
{
+#ifdef HAVE_SIGACTION
sigaction (SIGILL, &oldaction, NULL);
+#else
+ signal (SIGILL, oldhandler);
+#endif
}
diff --git a/liboil/liboilfunction.c b/liboil/liboilfunction.c
index 11c4251..2999b99 100644
--- a/liboil/liboilfunction.c
+++ b/liboil/liboilfunction.c
@@ -353,7 +353,7 @@ oil_class_register_impl_by_name (const char *klass_name, OilFunctionImpl *impl)
}
/**
- * oil_class_register_impl_by_name:
+ * oil_class_register_impl:
* @klass: the class
* @impl: an implementation
*
@@ -373,3 +373,29 @@ oil_class_register_impl (OilFunctionClass *klass, OilFunctionImpl *impl)
}
}
+/**
+ * oil_class_register_impl_full:
+ * @klass: the class
+ * @func: the function
+ * @name: name of the function
+ * @flags: CPU flags
+ *
+ * Adds @func to the list of implementations associated with
+ * the function class given by @klass.
+ */
+void
+oil_class_register_impl_full (OilFunctionClass *klass,
+ void (*func)(void), const char *name, unsigned int flags)
+{
+ OilFunctionImpl *impl;
+
+ impl = malloc(sizeof(OilFunctionImpl));
+ memset (impl, 0, sizeof(OilFunctionImpl));
+
+ impl->func = func;
+ impl->flags = flags;
+ impl->name = strdup(name);
+
+ oil_class_register_impl(klass,impl);
+}
+
diff --git a/liboil/liboilfunction.h b/liboil/liboilfunction.h
index 4a1be76..43ef222 100644
--- a/liboil/liboilfunction.h
+++ b/liboil/liboilfunction.h
@@ -154,9 +154,12 @@ int oil_impl_is_runnable (OilFunctionImpl *impl);
void oil_class_choose_by_name (OilFunctionClass * klass, const char *name);
+void oil_class_register_impl_full (OilFunctionClass * klass,
+ void (*func)(void), const char *name, unsigned int flags);
void oil_class_register_impl (OilFunctionClass * klass, OilFunctionImpl *impl);
void oil_class_register_impl_by_name (const char *klass_name,
OilFunctionImpl *impl);
+
#endif
diff --git a/liboil/liboilprofile.c b/liboil/liboilprofile.c
index 4331343..c15a5ec 100644
--- a/liboil/liboilprofile.c
+++ b/liboil/liboilprofile.c
@@ -38,9 +38,13 @@
unsigned long oil_profile_stamp_gtod (void)
{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return 1000000*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec;
+#ifdef HAVE_GETTIMEOFDAY
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ return 1000000*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec;
+#else
+ return 0;
+#endif
}
void