altos/stm: Run scheduler code on interrupt stack
authorKeith Packard <keithp@keithp.com>
Sat, 26 Mar 2016 22:49:59 +0000 (15:49 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 26 Mar 2016 23:07:20 +0000 (16:07 -0700)
This provides a bit more room for tasks on their stack

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm/ao_arch_funcs.h

index 42f1a2e5d75c5aeb4680dbf12c7c9b0f039e9ebb..02b344b11078edfc1eb8dd3283fe23c6022a4df9 100644 (file)
@@ -335,6 +335,13 @@ static inline void ao_arch_save_stack(void) {
 
 static inline void ao_arch_restore_stack(void) {
        uint32_t        sp;
+       uint32_t        control;
+
+       asm("mrs %0,control" : "=&r" (control));
+       control |= (1 << 1);
+       asm("msr control,%0" : : "r" (control));
+       asm("isb");
+
        sp = (uint32_t) ao_cur_task->sp;
 
        /* Switch stacks */
@@ -375,7 +382,14 @@ static inline void ao_arch_start_scheduler(void) {
 }
 #endif
 
-#define ao_arch_isr_stack()
+static inline void ao_arch_isr_stack(void) {
+       uint32_t        control;
+
+       asm("mrs %0,control" : "=&r" (control));
+       control &= ~(1 << 1);
+       asm("msr control,%0" : : "r" (control));
+       asm("isb");
+}
 
 #endif