Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / arch / i386-pc / exec / reschedule.c
blobd52a88901465508bc27697f45fe302e52b9a2b76
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <aros/atomic.h>
14 void Exec_Permit_Supervisor();
16 /*****i***********************************************************************
18 NAME */
19 #include <proto/exec.h>
21 AROS_LH1(void, Reschedule,
23 /* SYNOPSIS */
24 AROS_LHA(struct Task *, task, A0),
26 /* LOCATION */
27 struct ExecBase *, SysBase, 8, Exec)
29 /* FUNCTION
30 Reschedule will place the task into one of Execs internal task
31 lists. Which list it is placed in will depend upon whether the
32 task is ready to run, or whether it is waiting for an external
33 event to awaken it.
35 It is possible that in the future, more efficient schedulers
36 will be implemented. In which case this is the function that they
37 need to implement.
39 You should not do any costly calculations since you will be
40 running in interupt mode.
42 INPUTS
43 task - The task to insert into the list.
45 RESULT
46 The task will be inserted into one of Exec's task lists.
48 NOTES
49 Not actually complete yet. Some of the task states don't have any
50 supplied action.
52 EXAMPLE
54 BUGS
55 Only in relation to the comments within about low-priority tasks
56 not getting any processor time.
58 SEE ALSO
60 INTERNALS
62 HISTORY
64 ******************************************************************************/
66 AROS_LIBFUNC_INIT
68 UBYTE flag = SysBase->AttnResched; /* Save state of scheduling attention */
70 AROS_ATOMIC_OR(SysBase->AttnResched, 0x80);/* Set scheduling attention */
72 if (SysBase->TDNestCnt < 0) /* If task switching enabled */
74 if (SysBase->IDNestCnt < 0) /* And interrupts enabled */
76 Supervisor(Exec_Permit_Supervisor);
78 else if (!(flag & 0x80)) /* Generate software interrupt */
80 #if 0
81 #warning: "This is wrong!!!!!!!! It should cause the software interrupt only once interrupts are enabled again"
82 #warning "but this jumps directly to software interrupt, no matter if interrupts are enabled or not"
83 __asm__ ("movl $-3,%eax\n\tint $0x80");
84 #endif
88 AROS_LIBFUNC_EXIT
89 } /* Reschedule */