Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / .unmaintained / m68k-emul / switch.s
blobaa81b76d195012e5cb37019112e73893c6eb915a
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Exec function Switch
6 Lang: english
7 */
9 /******************************************************************************
11 NAME
13 AROS_LH0(void, Switch,
15 LOCATION
16 struct ExecBase *, SysBase, 9, Exec)
18 FUNCTION
19 Tries to switch to the first task in the ready list. This
20 function works almost like Dispatch() with the slight difference
21 that it may be called at any time and as often as you want and
22 that it does not lose the current task if it is of type TS_RUN.
24 INPUTS
27 RESULT
29 NOTES
30 This function is CPU dependant.
32 This function is for internal use by exec only.
34 This function preserves all registers.
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 Dispatch()
43 INTERNALS
45 HISTORY
47 ******************************************************************************/
49 #include "machine.i"
51 .text
52 .balign 16
53 .globl AROS_SLIB_ENTRY(Switch,Exec)
54 .type AROS_SLIB_ENTRY(Switch,Exec),@function
55 AROS_SLIB_ENTRY(Switch,Exec):
56 /* Check to see if we are called from supervisor */
57 tst.b AROS_CSYMNAME(supervisor)
58 jbeq .nosup
60 /* Called from supervisor mode - set the delayed dispatch flag
61 and return */
62 #if !UseRegisterArgs
63 move.l %a6,-(%sp)
64 move.l 8(%sp),%a6
65 #endif
66 bset #7,AttnResched(%a6)
67 #if !UseRegisterArgs
68 move.l (%sp)+,%a6
69 #endif
70 rts
72 /* Called from user mode */
73 .nosup:
74 /* Preserve scratch registers */
75 movem.l %d0-%d1/%a0-%a1,-(%sp)
77 /* Always disable interrupts when testing task lists */
78 jbsr AROS_CSYMNAME(os_disable)
79 #if !UseRegisterArgs
80 /* Get SysBase */
81 move.l 20(%sp),%a0
83 /* If not in state TS_RUN the current task is already moved
84 to one of the task lists. */
85 move.l ThisTask(%a0),%a1
86 #else
87 move.l ThisTask(%a6),%a1
88 #endif
89 cmpi.b #TS_RUN,tc_State(%a1)
90 jbne .disp
92 /* If TB_EXCEPT is not set... */
93 btst #TB_EXCEPT,tc_Flags(%a1)
94 jbne .disp
96 /* ...move task to the ready list */
97 move.b #TS_READY,tc_State(%a1)
98 #if !UseRegisterArgs
99 move.l %a0,-(%sp)
100 move.l %a1,-(%sp)
101 pea TaskReady(%a0)
102 jsr Enqueue(%a0)
103 addq.w #8,%sp
104 addq.w #4,%sp
105 #else
106 lea.l TaskReady(%a6),%a0
107 jsr Enqueue(%a6)
108 #endif
110 /* dispatch */
111 .disp: movem.l (%sp)+,%d0-%d1/%a0-%a1
112 #if !UseRegisterArgs
113 jmp AROS_SLIB_ENTRY(Dispatch,Exec)
114 #else
115 jmp Dispatch(%a6)
116 #endif