2 Copyright © 2011-2015, The AROS Development Team. All rights reserved.
5 Desc: High-level scheduler calling code
9 #include <exec/execbase.h>
10 #include <hardware/intbits.h>
11 #include <proto/exec.h>
13 #include <kernel_base.h>
14 #include <kernel_intr.h>
15 #include <kernel_scheduler.h>
16 #include <kernel_syscall.h>
18 #include "exec_platform.h"
21 * Leave the interrupt. This function receives the interrupt register frame
22 * and runs task scheduler if needed.
24 * You should call it only if you're returning to user mode (i.e. not from
25 * within nested interrupt).
27 * It relies on CPU-specific cpu_Switch() and cpu_Dispatch() implementations
28 * which save and restore CPU context. cpu_Dispatch() is allowed just to
29 * jump to the saved context and not return here.
31 void core_ExitInterrupt(regs_t
*regs
)
33 /* Soft interrupt requested? It's high time to do it */
34 if (SysBase
->SysFlags
& SFF_SoftInt
)
35 core_Cause(INTB_SOFTINT
, 1L << INTB_SOFTINT
);
37 /* If task switching is disabled, do nothing */
38 if (TDNESTCOUNT_GET
< 0)
41 * Do not disturb task if it's not necessary.
42 * Reschedule only if switch pending flag is set. Exit otherwise.
44 if (FLAG_SCHEDSWITCH_ISSET
)
46 /* Run task scheduling sequence */
57 * This routine dispatches scheduler's SysCall, when some task wants to give up
58 * the CPU time explicitly.
59 * Similar to above, it should be called only when you're returning to user mode.
61 void core_SysCall(int sc
, regs_t
*regs
)
66 core_ExitInterrupt(regs
);