2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Unix version of Switch().
9 #include <exec/execbase.h>
10 #include <proto/exec.h>
11 #include <proto/kernel.h>
12 #include <aros/kernel.h>
13 #include <proto/arossupport.h>
15 AROS_LH0(void, Switch
,
16 struct ExecBase
*, SysBase
, 9, Exec
)
20 struct Task
*this = SysBase
->ThisTask
;
22 KRNWireImpl(SoftEnable
);
23 KRNWireImpl(SoftDisable
);
24 KRNWireImpl(SoftCause
);
27 If the state is not TS_RUN then the task is already in a list
32 if( this->tc_State
!= TS_RUN
)
35 /* Its quite possible that they have interrupts Disabled(),
36 we should fix that here, otherwise we can't switch.
38 We can't call the dispatcher because we need a signal,
41 Have to set the dispatch-required flag.
42 I use SIGUSR1 (maps to SoftInt) because it has less effect on
43 the system clock, and is probably quicker.
46 /* We now re-enable software interrupts. */
47 CALLHOOKPKT(krnSoftEnableImpl
,0,0);
48 SysBase
->AttnResched
|= 0x8000;
49 CALLHOOKPKT(krnSoftCauseImpl
,0,0);
50 /* Disable software interrupts */
51 CALLHOOKPKT(krnSoftDisableImpl
,0,0);