From a7e0bb5eb661cfde31c383d605cb9cb8ca568bc7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 28 Jun 2016 17:04:59 -0700 Subject: altos: Block interrupts while waking tasks sleeping on timers. Interrupts may not be blocked in the timer ISR, but they need to be while walking the pending timer list and moving tasks back to the run queue. Signed-off-by: Keith Packard --- src/stm/ao_arch_funcs.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/stm') diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index 2c017c79..33359857 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -343,6 +343,14 @@ ao_arch_memory_barrier() { asm volatile("" ::: "memory"); } +static inline void +ao_arch_irq_check(void) { + uint32_t primask; + asm("mrs %0,primask" : "=&r" (primask)); + if ((primask & 1) == 0) + ao_panic(AO_PANIC_IRQ); +} + #if HAS_TASK static inline void ao_arch_init_stack(struct ao_task *task, void *start) -- cgit v1.2.3