sched: Interrupts must be disabled during setjmp() call
On the AVR platform (and possibly others) the longjmp() call will restore the interrupt state saved during the setjmp() call. So, the setjmp() call must be invoked with interrupts disabled to ensure that shutdown handling is run with interrupts disabled. This fixes potential corruption of the shutdown processing on AVR. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
1d21bf66c6
commit
d303e556ad
|
@ -282,6 +282,7 @@ sched_clear_shutdown(void)
|
|||
static void
|
||||
run_shutdown(int reason)
|
||||
{
|
||||
irq_disable();
|
||||
uint32_t cur = timer_read_time();
|
||||
if (!shutdown_status)
|
||||
shutdown_reason = reason;
|
||||
|
@ -334,9 +335,11 @@ sched_main(void)
|
|||
|
||||
sendf("starting");
|
||||
|
||||
irq_disable();
|
||||
int ret = setjmp(shutdown_jmp);
|
||||
if (ret)
|
||||
run_shutdown(ret);
|
||||
irq_enable();
|
||||
|
||||
run_tasks();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue