mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
Updates to cothreads code, including non-working alpha. Changed things a bit, including PPC. Not having a PPC machi...
Original commit message from CVS: Updates to cothreads code, including non-working alpha. Changed things a bit, including PPC. Not having a PPC machine, I need someone to test these changes and report back whether they worked or not.
This commit is contained in:
parent
6b317bf748
commit
fb871eec23
6 changed files with 69 additions and 12 deletions
|
@ -101,6 +101,7 @@ noinst_HEADERS = \
|
|||
gstarch.h \
|
||||
gsti386.h \
|
||||
gstppc.h \
|
||||
gstalpha.h \
|
||||
gstpropsprivate.h
|
||||
|
||||
CFLAGS = $(LIBGST_CFLAGS)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <sys/mman.h>
|
||||
|
||||
/* we make too much noise for normal debugging... */
|
||||
#define GST_DEBUG_FORCE_DISABLE
|
||||
//#define GST_DEBUG_FORCE_DISABLE
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "cothreads.h"
|
||||
|
@ -180,7 +180,7 @@ cothread_stub (void)
|
|||
thread->pc = 0;
|
||||
thread->sp = thread->top_sp;
|
||||
GST_DEBUG_LEAVE("");
|
||||
// printf("uh, yeah, we shouldn't be here, but we should deal anyway\n");
|
||||
fprintf(stderr,"uh, yeah, we shouldn't be here, but we should deal anyway\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,11 +258,12 @@ cothread_switch (cothread_state *thread)
|
|||
if (current == thread) goto selfswitch;
|
||||
|
||||
// find the number of the thread to switch to
|
||||
GST_INFO (GST_CAT_COTHREAD_SWITCH,"switching from cothread %d to to cothread #%d\n",
|
||||
ctx->current,thread->threadnum);
|
||||
ctx->current = thread->threadnum;
|
||||
GST_INFO (GST_CAT_COTHREAD_SWITCH,"switching to thread #%d",ctx->current);
|
||||
|
||||
/* save the current stack pointer, frame pointer, and pc */
|
||||
GET_SP(current->sp);
|
||||
// GET_SP(current->sp);
|
||||
enter = setjmp(current->jmp);
|
||||
if (enter != 0) {
|
||||
GST_DEBUG (0,"enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter,
|
||||
|
@ -277,14 +278,14 @@ cothread_switch (cothread_state *thread)
|
|||
/* restore stack pointer and other stuff of new cothread */
|
||||
if (thread->flags & COTHREAD_STARTED) {
|
||||
GST_DEBUG (0,"in thread \n");
|
||||
SET_SP(thread->sp);
|
||||
// SET_SP(thread->sp);
|
||||
// switch to it
|
||||
longjmp(thread->jmp,1);
|
||||
} else {
|
||||
SETUP_STACK(thread->sp);
|
||||
SET_SP(thread->sp);
|
||||
// start it
|
||||
cothread_stub();
|
||||
CALL(cothread_stub);
|
||||
GST_DEBUG (0,"exit thread \n");
|
||||
ctx->current = 0;
|
||||
}
|
||||
|
|
49
gst/gstalpha.h
Normal file
49
gst/gstalpha.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* 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_HGUARD_GSTALPHA_H
|
||||
#define GST_HGUARD_GSTALPHA_H
|
||||
|
||||
#warning in gstalpha.h
|
||||
|
||||
#define GET_SP(target) \
|
||||
__asm__("stq $30,%0" : "=m"(target) : : "30");
|
||||
|
||||
#define SET_SP(stackpointer) \
|
||||
__asm__("bis $31,%0,$30" : : "r"(stackpointer));
|
||||
|
||||
#define CALL(target) \
|
||||
__asm__( "bis $31,%0,$27\n\t" \
|
||||
"jsr $26,($27),0" : : "r"(target) );
|
||||
|
||||
struct minimal_ppc_stackframe {
|
||||
unsigned long back_chain;
|
||||
unsigned long LR_save;
|
||||
unsigned long unused1;
|
||||
unsigned long unused2;
|
||||
};
|
||||
|
||||
#define SETUP_STACK(sp) \
|
||||
sp = ((unsigned long *)(sp)) - 4; \
|
||||
((struct minimal_ppc_stackframe *)sp)->back_chain = 0;
|
||||
|
||||
#endif /* GST_HGUARD_GSTALPHA_H */
|
|
@ -33,8 +33,12 @@
|
|||
#ifdef HAVE_CPU_PPC
|
||||
#include "gstppc.h"
|
||||
#else
|
||||
#ifdef HAVE_CPU_ALPHA
|
||||
#include "gstalpha.h"
|
||||
#else
|
||||
#error Need to know about this architecture, or have a generic implementation
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __GST_GSTARCH_H__ */
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
#define GST_HGUARD_GSTI386_H
|
||||
|
||||
#define GET_SP(target) \
|
||||
__asm__("movl %%esp, %0" : "=m"(target) : : "esp", "ebp");
|
||||
__asm__( "movl %%esp, %0" : "=r"(target) : : "esp", "ebp" );
|
||||
|
||||
#define SET_SP(source) \
|
||||
__asm__("movl %0, %%esp\n" : "=m"(thread->sp));
|
||||
__asm__( "movl %0, %%esp\n" : : "r"(source) );
|
||||
|
||||
#define JUMP(target) \
|
||||
__asm__("jmp " SYMBOL_NAME_STR(cothread_stub))
|
||||
#define CALL(target) \
|
||||
__asm__("call *%0" : : "r"(target) );
|
||||
|
||||
#define SETUP_STACK(sp) do ; while(0)
|
||||
|
||||
|
|
|
@ -31,8 +31,10 @@
|
|||
#define SET_SP(source) \
|
||||
__asm__("lwz 1,%0" : "=m"(source))
|
||||
|
||||
#define JUMP(target) \
|
||||
__asm__("b " SYMBOL_NAME_STR(cothread_stub))
|
||||
#define CALL(target) \
|
||||
__asm__( "mr 0,%0\n\t" \
|
||||
"mtlr 0\n\t" \
|
||||
"blrl" : : "r"(target) );
|
||||
|
||||
struct minimal_ppc_stackframe {
|
||||
unsigned long back_chain;
|
||||
|
|
Loading…
Reference in a new issue