CM3: kernel preemption.
Kernel preemptible is implemented using the PendSV IRQ. Inside the
SysTick handler when a process expires its time quantum a pending
(PendSV) call is triggered.
At the end of the SysTick handler the PendSV handler is called, using
the architecture's tail-chaining functionality (an ISR call without the
overhead of state saving and restoration between different IRQs), and we
perform the stack-switching.
Voluntary context switch is implemented as a soft-interrupt call
(SVCall), so any process is always suspended / resumed from an interrupt
context.
NOTE: interrupts must be disabled or enabled when resuming a process
context in function of the type of suspension. If a process was
suspended by a voluntary context switch IRQs must be disabled on resume
(voluntary context switch always happen with IRQs disabled). Instead, if
a process was suspended by the kernel preemption IRQs must be always
re-enabled, because the PendSV handler resumes directly the process
context.
If CONFIG_KERN_PREEMPT is not enabled the cooperative implementation
fallback to the default stack-switching mechanism performed directly in
thread-mode and implemented as a normal function call.
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3396
38d2e660-2303-0410-9eaa-
f027e97ec537