Begun to add support for non i386 architectures, with the help of Chris
authorRichard Boulton <richard@tartarus.org>
Fri, 15 Sep 2000 22:44:10 +0000 (22:44 +0000)
committerRichard Boulton <richard@tartarus.org>
Fri, 15 Sep 2000 22:44:10 +0000 (22:44 +0000)
Original commit message from CVS:
Begun to add support for non i386 architectures, with the help of Chris
Emerson.  Added bits to configure to figure out architecture, and added
some alternatives for PPC.  Should cause no problems on i386, but I'll
check after this commit, but doesn't yet work on PPC by a fair way...

AUTHORS
acconfig.h
config.h.in [deleted file]
configure.in
gst/Makefile.am
gst/cothreads.c
gst/gstarch.h [new file with mode: 0644]
gst/gsti386.h [new file with mode: 0644]
gst/gstppc.h [new file with mode: 0644]
libs/getbits/Makefile.am

diff --git a/AUTHORS b/AUTHORS
index 132333b..5e038ae 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,3 @@
 Erik Walthinsen <omega@cse.ogi.edu>
 Wim Taymans <wim.taymans@tvd.be>
-Richard Boulton <richardb@users.sourceforge.net>
+Richard Boulton <richard@tartarus.org>
index 84726a9..06394d0 100644 (file)
@@ -2,6 +2,9 @@
 #undef PLUGINS_SRCDIR
 #undef PLUGINS_USE_SRCDIR
 
+#undef HAVE_CPU_I386
+#undef HAVE_CPU_PPC
+
 #undef HAVE_GDK_PIXBUF
 #undef HAVE_LIBGHTTP
 #undef HAVE_LIBMMX
diff --git a/config.h.in b/config.h.in
deleted file mode 100644 (file)
index 23093e2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* config.h.in.  Generated automatically from configure.in by autoheader.  */
-
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
-
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
-
-/* Define if the X Window System is missing or not being used.  */
-#undef X_DISPLAY_MISSING
-
-#undef PLUGINS_DIR
-#undef PLUGINS_SRCDIR
-#undef PLUGINS_USE_SRCDIR
-
-#undef HAVE_GDK_PIXBUF
-#undef HAVE_LIBGHTTP
-#undef HAVE_LIBMMX
-#undef HAVE_XAUDIO
-#undef HAVE_CSSAUTH
-#undef HAVE_NASM
-
-#undef HAVE_ATOMIC_H
-
-#undef DEBUG_ENABLED
-
-/* Name of package */
-#undef PACKAGE
-
-/* Version number of package */
-#undef VERSION
-
index 11f1000..40d4ec3 100644 (file)
@@ -1,5 +1,7 @@
 AC_INIT(gst/gstobject.h)
 
+AC_CANONICAL_SYSTEM
+
 AM_CONFIG_HEADER(config.h)
 
 STREAMER_MAJOR_VERSION=0
@@ -42,6 +44,17 @@ dnl ##############################
 dnl # Do automated configuration #
 dnl ##############################
 
+dnl Set up conditionals for (target) host type:
+dnl ===========================================
+
+case "x${target_cpu}" in
+  xi386)     HAVE_CPU_I386=yes ;
+             AC_DEFINE(HAVE_CPU_I386) ;;
+  xpowerpc)  HAVE_CPU_PPC=yes ;
+             AC_DEFINE(HAVE_CPU_PPC) ;;
+esac
+
+
 dnl Check for tools:
 dnl ================
 
@@ -101,6 +114,7 @@ dnl Check for gtk
 AM_PATH_GTK(1.2.0)
 
 dnl Check for libghttp
+dnl FIXME: need to check for header
 AC_CHECK_LIB(ghttp, ghttp_request_new,
   [GHTTP_LIBS="-lghttp"
    GST_HTTPSRC_GET_TYPE="gst_httpsrc_get_type"
@@ -331,6 +345,8 @@ dnl #############################
 
 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
 dnl HAVE_ and it is likely to be easier to stick with the old name
+AM_CONDITIONAL(HAVE_CPU_I386,       test "x$HAVE_CPU_I386" = "xyes")
+AM_CONDITIONAL(HAVE_CPU_PPC,        test "x$HAVE_CPU_PPC" = "xyes")
 AM_CONDITIONAL(HAVE_GDK_PIXBUF,     test "x$USE_GDK_PIXBUF" = "xyes")
 AM_CONDITIONAL(HAVE_LIBGHTTP,       test "x$USE_LIBGHTTP" = "xyes")
 AM_CONDITIONAL(HAVE_LIBMMX,         test "x$USE_LIBMMX" = "xyes")
index 00ffc27..4543248 100644 (file)
@@ -8,6 +8,16 @@ GSTOBJECT_SRCS =       \
 GSTOBJECT_INCLUDES =   \
        gstobject.h
 
+if HAVE_CPU_I386
+GSTARCH_SRCS = gstcpuid_i386.s
+else
+if HAVE_CPU_PPC
+GSTARCH_SRCS = gstppc.c
+else
+GSTARCH_SRCS = 
+endif
+endif
+
 libgst_la_SOURCES =    \
        gst.c           \
        $(GSTOBJECT_SRCS)       \
@@ -16,7 +26,8 @@ libgst_la_SOURCES =   \
        gstbufferpool.c \
        gstclock.c      \
        gstcpu.c        \
-       gstcpuid_i386.s \
+       $(GSTI386_SRCS) \
+       $(GSTPPC_SRCS)  \
        gstelement.c    \
        gstelementfactory.c     \
        gstbin.c        \
index 4d57fe0..2a4262c 100644 (file)
@@ -9,6 +9,7 @@
 #include <sys/mman.h>
 
 #include "cothreads.h"
+#include "gstarch.h"
 
 pthread_key_t _cothread_key = -1;
 
@@ -130,7 +131,7 @@ void cothread_switch(cothread_state *thread) {
   fprintf(stderr,"about to switch to thread #%d\n",ctx->current);
 
   /* save the current stack pointer, frame pointer, and pc */
-  __asm__("movl %%esp, %0" : "=m"(current->sp) : : "esp", "ebp");
+  GET_SP(current->sp);
   enter = setjmp(current->jmp);
   if (enter != 0)
     return;
@@ -140,12 +141,12 @@ void cothread_switch(cothread_state *thread) {
   /* restore stack pointer and other stuff of new cothread */
   if (thread->flags & COTHREAD_STARTED) {
     fprintf(stderr,"in thread \n");
-    __asm__("movl %0, %%esp\n" : "=m"(thread->sp));
+    SET_SP(thread->sp);
     // switch to it
     longjmp(thread->jmp,1);
   } else {
-    __asm__("movl %0, %%esp\n" : "=m"(thread->sp));
+     SET_SP(thread->sp);
     // start it
-    __asm__("jmp " SYMBOL_NAME_STR(cothread_stub));
+    JUMP(cothread_stub);
   }
 }
diff --git a/gst/gstarch.h b/gst/gstarch.h
new file mode 100644 (file)
index 0000000..0e1ae82
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef GST_HGUARD_GSTARCH_H
+#define GST_HGUARD_GSTARCH_H
+
+#ifdef __I386__
+#include "gsti386.h"
+#endif
+
+#ifdef __PPC__
+#include "gstppc.h"
+#endif
+
+#endif /* GST_HGUARD_GSTARCH_H */
diff --git a/gst/gsti386.h b/gst/gsti386.h
new file mode 100644 (file)
index 0000000..485ff58
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef GST_HGUARD_GSTI386_H
+#define GST_HGUARD_GSTI386_H
+
+/* Hmm - does this work, or do the braces cause other stack manipulation?
+ * XXX
+ */
+#define GET_SP(target) \
+  __asm__("movl %%esp, %0" : "=m"(target) : : "esp", "ebp");
+
+#define SET_SP(source) \
+  __asm__("movl %0, %%esp\n" : "=m"(thread->sp));
+
+#define JUMP(target) \
+    __asm__("jmp " SYMBOL_NAME_STR(cothread_stub))
+
+#endif /* GST_HGUARD_GSTI386_H */
diff --git a/gst/gstppc.h b/gst/gstppc.h
new file mode 100644 (file)
index 0000000..1e77389
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef GST_HGUARD_GSTPPC_H
+#define GST_HGUARD_GSTPPC_H
+
+/* Hmm - does this work, or do the braces cause other stack manipulation?
+ * XXX
+ */
+#define GET_SP(target) { \
+       register unsigned long r1 __asm__("r1"); \
+       target = r1; \
+}
+
+#define SET_SP(source) { \
+       register unsigned long r1 __asm__("r1"); \
+       r1 = source; \
+}
+
+#define JUMP(target) \
+    __asm__("b " SYMBOL_NAME_STR(cothread_stub))
+
+#endif /* GST_HGUARD_GSTPPC_H */
index 7c926ff..cc5c1e0 100644 (file)
@@ -2,7 +2,17 @@ filterdir = $(libdir)/gst
 
 filter_LTLIBRARIES = libgstgetbits.la
 
-libgstgetbits_la_SOURCES = gstgetbits.c gstgetbits_inl.h gstgetbits_i386.s
+if HAVE_CPU_I386
+GSTARCH_SRCS = gstgetbits_i386.s
+else
+if HAVE_CPU_PPC
+GSTARCH_SRCS = gstgetbits_generic.c
+else
+GSTARCH_SRCS =
+endif
+endif
+
+libgstgetbits_la_SOURCES = gstgetbits.c gstgetbits_inl.h $(GSTARCH_SRCS)
 
 libgstgetbitsincludedir = $(includedir)/gst/libs/gstgetbits
 libgstgetbitsinclude_HEADERS = gstgetbits.h