altos/lpc, altos/stm: ARM requires ISB after switching stack pointers
authorKeith Packard <keithp@keithp.com>
Tue, 8 Oct 2013 04:53:53 +0000 (21:53 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 8 Oct 2013 04:53:53 +0000 (21:53 -0700)
This sticks a barrier in the CPU to prevent using the wrong stack
register past the change.

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

index 9a3219a2e6275e55a6972dcdf5fff53a390b75c5..0891903ea5f00cb2adae5dbf57506fcdcb81a5c5 100644 (file)
@@ -235,6 +235,7 @@ static inline void ao_arch_start_scheduler(void) {
        asm("mrs %0,control" : "=&r" (control));
        control |= (1 << 1);
        asm("msr control,%0" : : "r" (control));
+       asm("isb");
 }
 
 #endif /* _AO_ARCH_FUNCS_H_ */
index 9bb2d7cd5d830c158bd0dbbeb01ec3a39b63d64c..4bcc102324a5cb63fe49d518e684d4ffc072dcd6 100644 (file)
@@ -354,6 +354,7 @@ static inline void ao_arch_start_scheduler(void) {
        asm("mrs %0,control" : "=&r" (control));
        control |= (1 << 1);
        asm("msr control,%0" : : "r" (control));
+       asm("isb");
 }
 #endif