From 1aff968e49e7c9774e0b9c38b34f4a0b15189071 Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Wed, 5 Sep 2001 21:36:24 +0000 Subject: [PATCH] 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. --- configure.base | 2 + gst/Makefile.am | 9 +--- gst/gstalpha.h | 46 ------------------- gst/gstarch.h | 117 +++++++++++++++++++++++++++++++++++++++++++++--- gst/gstarm.h | 37 --------------- gst/gsti386.h | 35 --------------- gst/gstppc.h | 49 -------------------- gst/gstsparc.h | 42 ----------------- 8 files changed, 116 insertions(+), 221 deletions(-) delete mode 100644 gst/gstalpha.h delete mode 100644 gst/gstarm.h delete mode 100644 gst/gsti386.h delete mode 100644 gst/gstppc.h delete mode 100644 gst/gstsparc.h diff --git a/configure.base b/configure.base index 1fa433cd79..1720bd6ad0 100644 --- a/configure.base +++ b/configure.base @@ -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 diff --git a/gst/Makefile.am b/gst/Makefile.am index efd552391e..08c2a813e6 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -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)"\" diff --git a/gst/gstalpha.h b/gst/gstalpha.h deleted file mode 100644 index 0d200197b9..0000000000 --- a/gst/gstalpha.h +++ /dev/null @@ -1,46 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * 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__ */ diff --git a/gst/gstarch.h b/gst/gstarch.h index d78e768cf7..7634819dc5 100644 --- a/gst/gstarch.h +++ b/gst/gstarch.h @@ -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 diff --git a/gst/gstarm.h b/gst/gstarm.h deleted file mode 100644 index 435b23063f..0000000000 --- a/gst/gstarm.h +++ /dev/null @@ -1,37 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * 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__ */ diff --git a/gst/gsti386.h b/gst/gsti386.h deleted file mode 100644 index 7aa9e40912..0000000000 --- a/gst/gsti386.h +++ /dev/null @@ -1,35 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * 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__ */ diff --git a/gst/gstppc.h b/gst/gstppc.h deleted file mode 100644 index 80e2781991..0000000000 --- a/gst/gstppc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * 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__ */ diff --git a/gst/gstsparc.h b/gst/gstsparc.h deleted file mode 100644 index 855207734e..0000000000 --- a/gst/gstsparc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * 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__ */