make the linux-ppc packags be in synch with other platforms
[tangerine.git] / arch / m68k-mac / exec / switch.c
blobbe7ea211074fe2c72cfbbd42023f16c0a4a8a09b
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Native version of Switch().
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <proto/exec.h>
12 AROS_LH0(void, Switch,
13 struct ExecBase *, SysBase, 9, Exec)
15 AROS_LIBFUNC_INIT
17 struct Task *this = SysBase->ThisTask;
20 If the state is not TS_RUN then the task is already in a list
23 Disable();
25 if( (this->tc_State != TS_RUN)
26 && !(this->tc_Flags & TF_EXCEPT) )
28 /* Its quite possible that they have interrupts Disabled(),
29 we should fix that here, otherwise we can't switch.
31 We can't call the dispatcher because we need a signal,
32 lets just create one.
34 Have to set the dispatch-required flag.
35 I use SIGUSR1 (maps to SoftInt) because it has less effect on
36 the system clock, and is probably quicker.
39 SysBase->AttnResched |= 0x8000;
40 __asm__ __volatile__ ("move.l %d7,-(%sp)\n\t"
41 "clr.l %d7\n\t"
42 "trap #1\n\t"
43 "move.l (%sp)+,%d7\n\t");
46 Enable();
48 AROS_LIBFUNC_EXIT
49 } /* Switch() */