2000-11-11 15:13:50 +00:00
|
|
|
/* GStreamer
|
2000-12-28 22:12:02 +00:00
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstarch.h: Architecture-specific inclusions
|
2000-11-11 15:13:50 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2000-12-28 22:12:02 +00:00
|
|
|
#ifndef __GST_GSTARCH_H__
|
|
|
|
#define __GST_GSTARCH_H__
|
2000-09-15 22:44:10 +00:00
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-09-15 23:04:31 +00:00
|
|
|
#include "config.h"
|
2000-12-15 01:57:34 +00:00
|
|
|
#endif
|
2000-09-15 22:44:10 +00:00
|
|
|
|
2001-09-05 21:36:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***** Intel x86 *****/
|
2001-01-19 09:14:42 +00:00
|
|
|
#if defined(HAVE_CPU_I386)
|
2001-09-05 21:36:24 +00:00
|
|
|
#define GST_ARCH_SET_SP(stackpointer) \
|
|
|
|
__asm__( "movl %0, %%esp\n" : : "r"(stackpointer) );
|
|
|
|
|
|
|
|
#define GST_ARCH_CALL(target) \
|
|
|
|
__asm__("call *%0" : : "r"(target) );
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* assuming the stackframe is 16 bytes */
|
2001-09-05 21:36:24 +00:00
|
|
|
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***** PowerPC *****/
|
2001-01-19 09:14:42 +00:00
|
|
|
#elif defined (HAVE_CPU_PPC)
|
2001-09-05 21:36:24 +00:00
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* should bring this in line with others and use an "r" */
|
2001-09-05 21:36:24 +00:00
|
|
|
#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 *****/
|
2001-01-19 09:14:42 +00:00
|
|
|
#elif defined(HAVE_CPU_ALPHA)
|
2001-09-05 21:36:24 +00:00
|
|
|
|
|
|
|
#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) );
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* Need to get more information about the stackframe format
|
|
|
|
* and get the fields more correct. Check GDB sources maybe?
|
|
|
|
*/
|
2001-09-05 21:36:24 +00:00
|
|
|
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 *****/
|
2001-01-19 09:14:42 +00:00
|
|
|
#elif defined(HAVE_CPU_ARM)
|
2001-09-05 21:36:24 +00:00
|
|
|
|
|
|
|
#define GST_ARCH_SET_SP(stackpointer) \
|
|
|
|
__asm__( "mov sp, %0" : : "r"(stackpointer));
|
|
|
|
|
|
|
|
#define GST_ARCH_CALL(target) \
|
|
|
|
__asm__( "mov pc, %0" : : "r"(target) );
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* Need to get more information about the stackframe format
|
|
|
|
* and get the fields more correct. Check GDB sources maybe?
|
|
|
|
*/
|
2001-09-05 21:36:24 +00:00
|
|
|
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***** Sun SPARC *****/
|
2001-03-02 18:30:37 +00:00
|
|
|
#elif defined(HAVE_CPU_SPARC)
|
2001-09-05 21:36:24 +00:00
|
|
|
|
|
|
|
#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" );
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* Need to get more information about the stackframe format
|
|
|
|
* and get the fields more correct. Check GDB sources maybe?
|
|
|
|
*/
|
2001-09-05 21:36:24 +00:00
|
|
|
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***** MIPS *****/
|
|
|
|
#elif defined(HAVE_CPU_MIPS)
|
|
|
|
|
|
|
|
#define GST_ARCH_SET_SP(stackpointer) \
|
2001-12-18 16:50:05 +00:00
|
|
|
__asm__("lw $sp,0(%0)\n\t" : : "r"(stackpointer));
|
2001-09-05 21:36:24 +00:00
|
|
|
|
|
|
|
#define GST_ARCH_CALL(target) \
|
2001-12-18 16:50:05 +00:00
|
|
|
__asm__("lw $25,0(%0)\n\t" /* call via $25 */ \
|
2001-09-05 21:36:24 +00:00
|
|
|
"jal $25\n\t" : : "r"(target));
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* assuming the stackframe is 16 bytes */
|
2001-09-05 21:36:24 +00:00
|
|
|
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-05 21:50:43 +00:00
|
|
|
/***** HP-PA *****/
|
|
|
|
#elif defined(HAVE_CPU_HPPA)
|
|
|
|
|
|
|
|
#define GST_ARCH_SET_SP(stackpointer) \
|
|
|
|
__asm__("copy %0,%%sp\n\t" : : "r"(stackpointer));
|
|
|
|
|
|
|
|
#define GST_ARCH_CALL(target) \
|
2002-10-17 23:02:59 +00:00
|
|
|
__asm__("copy %0,%%r22\n\t" /* set call address */ \
|
2001-09-10 20:02:12 +00:00
|
|
|
".CALL\n\t" /* call pseudo insn (why?) */ \
|
2001-09-05 21:50:43 +00:00
|
|
|
"bl $$dyncall,%%r31\n\t" : : "r"(target));
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/* assume stackframe is 16 bytes */
|
2001-09-05 21:50:43 +00:00
|
|
|
#define GST_ARCH_SETUP_STACK(sp) sp -= 4
|
|
|
|
|
2002-12-02 19:09:47 +00:00
|
|
|
/***** S/390 *****/
|
|
|
|
#elif defined(HAVE_CPU_S390)
|
|
|
|
|
|
|
|
#define GST_ARCH_SET_SP(stackpointer) \
|
|
|
|
__asm__("lr 15,%0" : : "r"(stackpointer))
|
|
|
|
|
|
|
|
#define GST_ARCH_CALL(target) \
|
|
|
|
__asm__( "basr 14,%0" : : "a"(target) );
|
|
|
|
|
|
|
|
struct minimal_s390_stackframe {
|
|
|
|
unsigned long back_chain;
|
|
|
|
unsigned long reserved;
|
|
|
|
unsigned long greg[14];
|
|
|
|
double freg[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_ARCH_SETUP_STACK(sp) \
|
|
|
|
sp = ((unsigned long *)(sp)) - 24; \
|
|
|
|
((struct minimal_s390_stackframe *)sp)->back_chain = 0;
|
2001-09-05 21:50:43 +00:00
|
|
|
|
|
|
|
|
2002-12-09 01:41:05 +00:00
|
|
|
#elif defined(HAVE_MAKECONTEXT)
|
|
|
|
|
|
|
|
/* If we have makecontext(), we'll be using that. */
|
2002-12-11 21:33:07 +00:00
|
|
|
#define USE_MAKECONTEXT 1
|
2002-12-09 01:41:05 +00:00
|
|
|
|
2001-01-18 08:54:25 +00:00
|
|
|
#else
|
2000-09-16 00:59:12 +00:00
|
|
|
#error Need to know about this architecture, or have a generic implementation
|
2000-09-15 23:04:31 +00:00
|
|
|
#endif
|
2000-09-15 22:44:10 +00:00
|
|
|
|
2000-12-28 22:12:02 +00:00
|
|
|
#endif /* __GST_GSTARCH_H__ */
|