Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-sam440 / exec / reschedule.c
blob330a04d907e6e28957a42a5fcf19343ed576a6cd
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>
13 #include <proto/kernel.h>
15 #include "../kernel/kernel_intern.h"
17 /*****i***********************************************************************
19 NAME */
20 #include <proto/exec.h>
22 AROS_LH1(void, Reschedule,
24 /* SYNOPSIS */
25 AROS_LHA(struct Task *, task, A0),
27 /* LOCATION */
28 struct ExecBase *, SysBase, 8, Exec)
30 /* FUNCTION
31 Reschedule will place the task into one of Execs internal task
32 lists. Which list it is placed in will depend upon whether the
33 task is ready to run, or whether it is waiting for an external
34 event to awaken it.
36 It is possible that in the future, more efficient schedulers
37 will be implemented. In which case this is the function that they
38 need to implement.
40 You should not do any costly calculations since you will be
41 running in interupt mode.
43 INPUTS
44 task - The task to insert into the list.
46 RESULT
47 The task will be inserted into one of Exec's task lists.
49 NOTES
50 Not actually complete yet. Some of the task states don't have any
51 supplied action.
53 EXAMPLE
55 BUGS
56 Only in relation to the comments within about low-priority tasks
57 not getting any processor time.
59 SEE ALSO
61 INTERNALS
63 HISTORY
65 ******************************************************************************/
67 AROS_LIBFUNC_INIT
69 UBYTE flag = SysBase->AttnResched; /* Save state of scheduling attention */
71 AROS_ATOMIC_OR(SysBase->AttnResched, 0x80);/* Set scheduling attention */
73 if (SysBase->TDNestCnt < 0) /* If task switching enabled */
75 if (SysBase->IDNestCnt < 0) /* And interrupts enabled */
77 void *KernelBase = getKernelBase();
79 KrnSchedule();
81 else if (!(flag & 0x80)) /* Generate software interrupt */
83 #if 0
84 #warning: "This is wrong!!!!!!!! It should cause the software interrupt only once interrupts are enabled again"
85 #warning "but this jumps directly to software interrupt, no matter if interrupts are enabled or not"
86 __asm__ ("movl $-3,%eax\n\tint $0x80");
87 #endif
91 AROS_LIBFUNC_EXIT
92 } /* Reschedule */