Begun to add support for non i386 architectures, with the help of Chris

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...
This commit is contained in:
Richard Boulton 2000-09-15 22:44:10 +00:00
parent 3239d7cb0c
commit 238bbc23c8
10 changed files with 96 additions and 39 deletions

View file

@ -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>

View 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

View file

@ -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

View 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")

View 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 \

View 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);
}
}

12
gst/gstarch.h Normal file
View file

@ -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 */

16
gst/gsti386.h Normal file
View file

@ -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 */

20
gst/gstppc.h Normal file
View file

@ -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 */

View 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