native_sim: IRQ handling: dont swap if kernel is uninitialized
After an interrupt, do not attempt to swap if the kernel is not yet initialized. Otherwise, if an interrupt is raised with interrupts unlocked while the kernel is not yet fully initialized, a swap would lead to a crash. (This could happen if a PREKERNEK1/2 driver enables interrupts and an interrupt fires before the kernel has swapped to main) Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
dcd6ee5188
commit
e543fbdf9a
1 changed files with 1 additions and 1 deletions
|
@ -106,7 +106,7 @@ void posix_irq_handler(void)
|
|||
*/
|
||||
if (may_swap
|
||||
&& (hw_irq_ctrl_get_cur_prio() == 256)
|
||||
&& (_kernel.ready_q.cache != _current)) {
|
||||
&& (_kernel.ready_q.cache) && (_kernel.ready_q.cache != _current)) {
|
||||
|
||||
(void)z_swap_irqlock(irq_lock);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue