When an interrupt occurs, the task context is not saved. At the end of the ISR, there is a check made to see if a new task has been enabled by the processing within the interrupt.
In most cases, there is no change and processing returns to the task that was interrupted. If this is the case, there is no overhead for saving and restoring all the task context.
In cases where a different task must run, a software interrupt is raised at the end of the ISR. When the ISR returns, the kernel trap ISR is invoked due to the software interrupt. This can save the context for the current task and restore the context for the new task.
Defines | |
#define | TIROS_KERNEL_TRAP_ENABLED 1 |
Functions | |
void | OS_KERNEL_TRAP (void) |
#define TIROS_KERNEL_TRAP_ENABLED 1 |
Is a kernel trap possible on this architecture? If not, set TIROS_KERNEL_TRAP_ENABLED to 0.
Definition at line 374 of file template/tr_port.h.
void OS_KERNEL_TRAP | ( | void | ) |
Implement the code to Invoke a kernel trap (i.e., create a software interrupt).
OS_KERNEL_TRAP() is called from within an ISR. On hardware where kernel trap is not possible, this function may set a flag which determines if the scheduler has to be invoked at the end of the ISR.