added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / arm-all / exec / switch.c
blob50ec24cc2e18d693a242c40d966b33505faed66d
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 #define DEBUG 0
13 #include <aros/debug.h>
15 #include "arm_exec_internal.h"
17 AROS_LH0(void, Switch,
18 struct ExecBase *, SysBase, 9, Exec)
20 AROS_LIBFUNC_INIT
22 struct Task *this = SysBase->ThisTask;
25 If the state is not TS_RUN then the task is already in a list
27 Disable();
29 if( (this->tc_State != TS_RUN)
30 && !(this->tc_Flags & TF_EXCEPT) )
32 /* Its quite possible that they have interrupts Disabled(),
33 we should fix that here, otherwise we can't switch.
35 We can't call the dispatcher because we need a signal,
36 lets just create one.
38 Have to set the dispatch-required flag.
39 I use SIGUSR1 (maps to SoftInt) because it has less effect on
40 the system clock, and is probably quicker.
43 SysBase->AttnResched |= 0x8000;
44 __asm__ __volatile__ ("swi #0\n\t");
47 Enable();
49 AROS_LIBFUNC_EXIT
50 } /* Switch() */