From e7e2fdf45dfbf6393ee0a0ec22e1e5ea49d6cfd5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 May 2011 00:12:40 -0700 Subject: src-avr: Suspend interrupts while switching stacks Setting the stack pointer takes two instructions, so make sure we don't get an interrupt in the middle of it. Let the restoration of SREG set the interrupt flag as appropriate. Signed-off-by: Keith Packard --- src-avr/ao.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src-avr/ao.h') diff --git a/src-avr/ao.h b/src-avr/ao.h index 242c26c7..90298a3e 100644 --- a/src-avr/ao.h +++ b/src-avr/ao.h @@ -50,7 +50,11 @@ struct ao_task { __xdata void *wchan; /* current wait channel (NULL if running) */ uint16_t alarm; /* abort ao_sleep time */ +#ifdef AVR + uint8_t *sp; /* saved stack pointer */ +#else uint8_t stack_count; /* amount of saved stack */ +#endif uint8_t task_id; /* unique id */ __code char *name; /* task name */ uint8_t stack[AO_STACK_SIZE]; /* saved stack */ -- cgit v1.2.3