grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / exec / reschedule.c
blobd4dc86f6579bad1bdf8fe848c3dbd865592f700e
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Enforce task rescheduling
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <aros/atomic.h>
12 #include <hardware/intbits.h>
13 #include <proto/kernel.h>
15 #include "chipset.h"
16 #include "exec_intern.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/exec.h>
23 AROS_LH0(void, Reschedule,
25 /* SYNOPSIS */
27 /* LOCATION */
28 struct ExecBase *, SysBase, 8, Exec)
30 /* FUNCTION
31 Give up the CPU time to other tasks (if there are any).
33 INPUTS
34 None
36 RESULT
37 None
39 NOTES
40 This function was private in AmigaOS(tm) up to v3.1. There's no guarantee
41 that it will continue to exist in other systems.
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 HISTORY
53 ******************************************************************************/
55 AROS_LIBFUNC_INIT
57 BOOL switchpending = FLAG_SCHEDSWITCH_ISSET;
59 FLAG_SCHEDSWITCH_SET; /* Set scheduling attention */
61 if (TDNESTCOUNT_GET < 0) /* If task switching enabled */
63 if (IDNESTCOUNT_GET < 0) /* And interrupts enabled */
65 D(bug("[Reschedule] Calling scheduler, KernelBase 0x%p\n", KernelBase);)
66 KrnSchedule(); /* Call scheduler */
68 else if (!switchpending)
71 * Interrupts are disabled and there was no pending switch before us.
72 * Tag the software interrupt to be executed immediately after Enable().
74 CUSTOM_CAUSE(INTF_SOFTINT);
78 AROS_LIBFUNC_EXIT
79 } /* Reschedule */