Add {WA_Shape, 0} to avoid Intuition and App
[tangerine.git] / arch / i386-all / dispatch.s
blob75fed1deeb585d3e7d24c14d9a337ab46e7fc97a
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Exec function Dispatch()
6 Lang: english
7 */
9 /******************************************************************************
11 NAME
12 AROS_LH0(void, Dispatch,
14 LOCATION
15 struct ExecBase *, SysBase, 10, Exec)
17 FUNCTION
19 INPUTS
21 RESULT
23 NOTES
25 EXAMPLE
27 BUGS
29 SEE ALSO
31 INTERNALS
33 HISTORY
35 ******************************************************************************/
37 #include "machine.i"
39 .text
40 .balign 16
41 .globl AROS_SLIB_ENTRY(Dispatch,Exec)
42 .type AROS_SLIB_ENTRY(Dispatch,Exec),@function
44 AROS_SLIB_ENTRY(Dispatch,Exec):
45 /* Push all registers */
46 pushl %eax
47 pushl %ebx
48 pushl %ecx
49 pushl %edx
50 pushl %edi
51 pushl %esi
52 pushl %ebp
54 /* block all signals */
55 call AROS_CSYMNAME(os_disable)
57 /* Get SysBase again */
58 movl 32(%esp),%ecx
60 /* Store sp */
61 movl ThisTask(%ecx),%edx
62 movl %esp,tc_SPReg(%edx)
64 /* Switch bit set? */
65 testb $TF_SWITCH,tc_Flags(%edx)
66 je 1f
67 movl tc_Switch(%edx),%eax
68 call *%eax
71 /* Store IDNestCnt */
72 movb IDNestCnt(%ecx),%al
73 movb %al,tc_IDNestCnt(%edx)
74 movb $-1,IDNestCnt(%ecx)
76 /* Get task from ready list */
77 movl TaskReady(%ecx),%edx
78 movl (%edx),%eax
79 movl %eax,TaskReady(%ecx)
80 movl (%edx),%eax
81 leal TaskReady(%ecx),%ebx
82 movl %ebx,4(%eax)
83 movl %edx,ThisTask(%ecx)
85 /* Use as current task */
86 movb $TS_RUN,tc_State(%edx)
87 movb tc_IDNestCnt(%edx),%al
88 movb %al,IDNestCnt(%ecx)
90 /* Launch bit set? */
91 cmpb $0,tc_Flags(%edx)
92 jge 2f
93 movl tc_Launch(%edx),%eax
94 call *%eax
97 /* Get new sp */
98 movl tc_SPReg(%edx),%eax
100 /* Compare agains SPLower */
101 cmpl %eax,tc_SPLower(%edx)
102 ja 3f
104 /* Compare against SPUpper */
105 cmpl %eax,tc_SPUpper(%edx)
106 ja 4f
109 /* Call Alert() */
110 pushl %ecx
111 pushl $(AT_DeadEnd|AN_StackProbe)
112 leal Alert(%ecx),%eax
113 call *%eax
114 /* Function does not return */
119 /* Put the SP into the correct register after checking */
120 movl %eax,%esp
122 /* Unblock signals if necessary */
123 cmpb $0,tc_IDNestCnt(%edx)
124 jge 5f
126 /* If called from the signal handler don't do it. */
127 cmpl $0,AROS_CSYMNAME(supervisor)
128 jne 5f
129 call AROS_CSYMNAME(os_enable)
132 /* Except bit set? */
133 testb $TF_EXCEPT,tc_Flags(%edx)
134 je 6f
136 /* Raise task exception in Disable()d state */
137 pushl %ecx
139 /* leal Disable(%ecx),%eax
140 call *%eax */
141 leal Exception(%ecx),%eax
142 call *%eax
143 /* movl (%esp),%ecx
144 leal Enable(%ecx),%eax */
145 call *%eax
146 addl $4,%esp
148 /* Restore registers and return */
150 popl %ebp
151 popl %esi
152 popl %edi
153 popl %edx
154 popl %ecx
155 popl %ebx
156 popl %eax