diff options
author | Keith Packard <keithp@keithp.com> | 2016-03-26 15:49:59 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-03-26 16:07:20 -0700 |
commit | 6a9546413d6a236c010e806b50506d870961d074 (patch) | |
tree | 5456f4ecf8e7af30a13d335689cfbb9774452adb /src | |
parent | 55db3b3e8addaa2dc0af50470d3bc8c25cb57df3 (diff) |
altos/stm: Run scheduler code on interrupt stack
This provides a bit more room for tasks on their stack
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/stm/ao_arch_funcs.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index 42f1a2e5..02b344b1 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -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 |