and moved all the architecture- specific code out of the many header files and put them all in gstarch.h.

Original commit message from CVS:
Added MIPS support to cothreads (untested), and moved all the architecture-
specific code out of the many header files and put them all in gstarch.h.
This commit is contained in:
Erik Walthinsen 2001-09-05 21:36:24 +00:00
parent a6e046ee3f
commit 1aff968e49
8 changed files with 116 additions and 221 deletions

View file

@ -139,6 +139,8 @@ case "x${target_cpu}" in
AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the target CPU is an ARM]) ;;
xsparc*) HAVE_CPU_SPARC=yes
AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the target CPU is a PPC]) ;;
xmips*) HAVE_CPU_MIPS=yes
AC_DEFINE(HAVE_CPU_MIPS, 1, [Define if the target CPU is a MIPS]) ;;
esac
dnl Determine endianness

View file

@ -97,10 +97,10 @@ libgst_la_SOURCES = \
# FIXME this only lists the x86 arch file, we really should merge them all
cothreads.lo: $(srcdir)/cothreads.c $(srcdir)/cothreads.h $(srcdir)/gst_private.h \
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h $(srcdir)/gsti386.h
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h
$(LIBTOOL) --mode=compile $(COMPILE) -O2 -c $<
cothreads.o: $(srcdir)/cothreads.c $(srcdir)/cothreads.h $(srcdir)/gst_private.h \
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h $(srcdir)/gsti386.h
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h
$(COMPILE) -O2 -c $<
# NOTDEPEND.cothreads.lo: cothreads.c
@ -190,11 +190,6 @@ libgstinclude_HEADERS = \
noinst_HEADERS = \
gst_private.h \
gstarch.h \
gsti386.h \
gstppc.h \
gstalpha.h \
gstarm.h \
gstsparc.h \
gstpropsprivate.h
CFLAGS = $(LIBGST_CFLAGS) -D_GNU_SOURCE -DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\"

View file

@ -1,46 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstppc.h: Header for PPC-specific architecture issues
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GSTALPHA_H__
#define __GST_GSTALPHA_H__
#define GST_ARCH_SET_SP(stackpointer) \
__asm__("bis $31,%0,$30" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__( "bis $31,%0,$27\n\t" \
"jsr $26,($27),0" : : "r"(target) );
// Need to get more information about the stackframe format
// and get the fields more correct. Check GDB sources maybe?
struct minimal_stackframe {
unsigned long back_chain;
unsigned long LR_save;
unsigned long unused1;
unsigned long unused2;
};
#define GST_ARCH_SETUP_STACK(sp) \
sp = ((unsigned long *)(sp)) - 4; \
((struct minimal_stackframe *)sp)->back_chain = 0;
#endif /* __GST_GSTALPHA_H__ */

View file

@ -27,16 +27,123 @@
#include "config.h"
#endif
/***** Intel x86 *****/
#if defined(HAVE_CPU_I386)
#include "gsti386.h"
#define GST_ARCH_SET_SP(stackpointer) \
__asm__( "movl %0, %%esp\n" : : "r"(stackpointer) );
#define GST_ARCH_CALL(target) \
__asm__("call *%0" : : "r"(target) );
// assuming the stackframe is 16 bytes
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
/***** PowerPC *****/
#elif defined (HAVE_CPU_PPC)
#include "gstppc.h"
// should bring this in line with others and use an "r"
#define GST_ARCH_SET_SP(stackpointer) \
__asm__("lwz 1,%0" : : "m"(stackpointer))
#define GST_ARCH_CALL(target) \
__asm__( "mr 0,%0\n\t" \
"mtlr 0\n\t" \
"blrl" : : "r"(target) );
struct minimal_ppc_stackframe {
unsigned long back_chain;
unsigned long LR_save;
unsigned long unused1;
unsigned long unused2;
};
#define GST_ARCH_SETUP_STACK(sp) \
sp = ((unsigned long *)(sp)) - 4; \
((struct minimal_ppc_stackframe *)sp)->back_chain = 0;
/***** DEC[/Compaq/HP?/Intel?] Alpha *****/
#elif defined(HAVE_CPU_ALPHA)
#include "gstalpha.h"
#define GST_ARCH_SET_SP(stackpointer) \
__asm__("bis $31,%0,$30" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__( "bis $31,%0,$27\n\t" \
"jsr $26,($27),0" : : "r"(target) );
// Need to get more information about the stackframe format
// and get the fields more correct. Check GDB sources maybe?
struct minimal_stackframe {
unsigned long back_chain;
unsigned long LR_save;
unsigned long unused1;
unsigned long unused2;
};
#define GST_ARCH_SETUP_STACK(sp) \
sp = ((unsigned long *)(sp)) - 4; \
((struct minimal_stackframe *)sp)->back_chain = 0;
/***** ARM *****/
#elif defined(HAVE_CPU_ARM)
#include "gstarm.h"
#define GST_ARCH_SET_SP(stackpointer) \
__asm__( "mov sp, %0" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__( "mov pc, %0" : : "r"(target) );
// Need to get more information about the stackframe format
// and get the fields more correct. Check GDB sources maybe?
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
/***** Sun SPARC *****/
#elif defined(HAVE_CPU_SPARC)
#include "gstsparc.h"
#define GST_ARCH_SET_SP(stackpointer) \
__asm__( "ta 3\n\t" \
"mov %0, %%sp" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__( "call %0,0\n\t" \
"nop" : : "r"(target) );
#define GST_ARCH_PRESETJMP() \
__asm__( "ta 3" );
// Need to get more information about the stackframe format
// and get the fields more correct. Check GDB sources maybe?
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
/***** MIPS *****/
#elif defined(HAVE_CPU_MIPS)
#define GST_ARCH_SET_SP(stackpointer) \
__asm__("move $sp,%0\n\t" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__("move $25,%1\n\t" // call via $25 \
"jal $25\n\t" : : "r"(target));
// assuming the stackframe is 16 bytes
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
#else
#error Need to know about this architecture, or have a generic implementation
#endif

View file

@ -1,37 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstarm.h: Header for ARM-specific architecture issues
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GSTARM_H__
#define __GST_GSTARM_H__
#define GST_ARCH_SET_SP(stackpointer) \
__asm__( "mov sp, %0" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__( "mov pc, %0" : : "r"(target) );
// Need to get more information about the stackframe format
// and get the fields more correct. Check GDB sources maybe?
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
#endif /* __GST_GSTARM_H__ */

View file

@ -1,35 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gsti386.h: Header for x86-specific architecture issues
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GSTI386_H__
#define __GST_GSTI386_H__
#define GST_ARCH_SET_SP(stackpointer) \
__asm__( "movl %0, %%esp\n" : : "r"(stackpointer) );
#define GST_ARCH_CALL(target) \
__asm__("call *%0" : : "r"(target) );
// assuming the stackframe is 16 bytes
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
#endif /* __GST_GSTI386_H__ */

View file

@ -1,49 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstppc.h: Header for PPC-specific architecture issues
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GSTPPC_H__
#define __GST_GSTPPC_H__
/* FIXME: Hmm - does this work?
*/
// should bring this in line with others and use an "r"
#define GST_ARCH_SET_SP(stackpointer) \
__asm__("lwz 1,%0" : : "m"(stackpointer))
#define GST_ARCH_CALL(target) \
__asm__( "mr 0,%0\n\t" \
"mtlr 0\n\t" \
"blrl" : : "r"(target) );
struct minimal_ppc_stackframe {
unsigned long back_chain;
unsigned long LR_save;
unsigned long unused1;
unsigned long unused2;
};
#define GST_ARCH_SETUP_STACK(sp) \
sp = ((unsigned long *)(sp)) - 4; \
((struct minimal_ppc_stackframe *)sp)->back_chain = 0;
#endif /* __GST_GSTPPC_H__ */

View file

@ -1,42 +0,0 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstsparc.h: Header for Sparc-specific architecture issues
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GSTSPARC_H__
#define __GST_GSTSPARC_H__
#define GST_ARCH_SET_SP(stackpointer) \
__asm__( "ta 3\n\t" \
"mov %0, %%sp" : : "r"(stackpointer));
#define GST_ARCH_CALL(target) \
__asm__( "call %0,0\n\t" \
"nop" : : "r"(target) );
#define GST_ARCH_PRESETJMP() \
__asm__( "ta 3" );
// Need to get more information about the stackframe format
// and get the fields more correct. Check GDB sources maybe?
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
#endif /* __GST_GSTSPARC_H__ */