2 Copyright © 2011, 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>
19 * Leave the interrupt. This function receives the interrupt register frame
20 * and runs task scheduler if needed.
22 * You should call it only if you're returning to user mode (i.e. not from
23 * within nested interrupt).
25 * It relies on CPU-specific cpu_Switch() and cpu_Dispatch() implementations
26 * which save and restore CPU context. cpu_Dispatch() is allowed just to
27 * jump to the saved context and not return here.
29 void core_ExitInterrupt(regs_t
*regs
)
31 /* Soft interrupt requested? It's high time to do it */
32 if (SysBase
->SysFlags
& SFF_SoftInt
)
33 core_Cause(INTB_SOFTINT
, 1L << INTB_SOFTINT
);
35 /* If task switching is disabled, do nothing */
36 if (SysBase
->TDNestCnt
< 0)
39 * Do not disturb task if it's not necessary.
40 * Reschedule only if switch pending flag is set. Exit otherwise.
42 if (SysBase
->AttnResched
& ARF_AttnSwitch
)
44 /* Run task scheduling sequence */
55 * This routine dispatches scheduler's SysCall, when some task wants to give up
56 * the CPU time explicitly.
57 * Similar to above, it should be called only when you're returning to user mode.
59 void core_SysCall(int sc
, regs_t
*regs
)
64 core_ExitInterrupt(regs
);