2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Exec function Dispatch()
9 /******************************************************************************
12 AROS_LH0(void, Dispatch,
15 struct ExecBase *, SysBase, 10, Exec)
35 ******************************************************************************/
41 .globl AROS_SLIB_ENTRY(Dispatch,Exec)
42 .type AROS_SLIB_ENTRY(Dispatch,Exec),@function
44 AROS_SLIB_ENTRY
(Dispatch
,Exec
):
45 /* move whole user context to user stack */
46 movem.
l %d0-
%d7
/%a0-
%a6
,-(%sp
)
51 jbsr AROS_CSYMNAME
(os_disable
)
53 /* get current task and store sp there */
54 move.
l ThisTask
(%a6
),%a2
55 move.
l %sp
,tc_SPReg
(%a2
)
57 /* call the switch routine if necessary */
58 btst
#TB_SWITCH,tc_Flags(%a2)
60 move.
l tc_Switch
(%a2
),%a5
65 move.
b IDNestCnt
(%a6
),tc_IDNestCnt
(%a2
)
66 move.
b #-1,IDNestCnt(%a6)
68 /* get task from ready list */
69 move.
l TaskReady
(%a6
),%a2
71 move.
l %a0
,TaskReady
(%a6
)
72 lea.
l TaskReady
(%a6
),%a1
75 /* and use it as new current task */
76 move.
l %a2
,ThisTask
(%a6
)
77 move.
b #TS_RUN,tc_State(%a2)
78 move.
b tc_IDNestCnt
(%a2
),IDNestCnt
(%a6
)
80 /* call the launch routine if necessary */
81 btst
#TB_LAUNCH,tc_Flags(%a2)
83 move.
l tc_Launch
(%a2
),%a5
86 /* get stack pointer */
88 move.
l tc_SPReg
(%a2
),%d0
90 /* Compare against SPLower */
91 cmp.
l tc_SPLower
(%a2
),%d0
94 /* Compare against SPUpper */
95 cmp.
l tc_SPUpper
(%a2
),%d0
98 /* Put the SP into the correct register after checking */
100 /* Unblock signals if necessary */
101 tst.
b tc_IDNestCnt
(%a2
)
103 /* If called from the signal handler don't do it. */
104 tst.
b AROS_CSYMNAME
(supervisor
)
106 jbsr AROS_CSYMNAME
(os_enable
)
109 /* Except bit set? */
110 btst
#TB_EXCEPT,tc_Flags(%a2)
113 /* Raise a task exception in Disable()d state. */
117 /* jsr Disable(%a6) */
119 /* jsr Enable(%a6) */
124 /* restore context. */
126 movem.
l (%sp
)+,%d0-
%d7
/%a0-
%a6
134 move.
l #AT_DeadEnd,%d7
135 or.l #AN_StackProbe,%d7
140 /* Function does not return */