1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Fix alignment of continuations stack

This commit is contained in:
Ivan Grokhotkov 2015-06-19 17:25:25 +03:00
parent 7a9563d6c6
commit 66be67ced2
4 changed files with 5 additions and 3 deletions

View File

@ -106,7 +106,7 @@ cont_resume:
cont_norm: cont_norm:
/* calculate pointer to cont_ctx.struct_start from sp */ /* calculate pointer to cont_ctx.struct_start from sp */
l32i a2, a1, 8 l32i a2, a1, 4
/* sp <- cont_ctx.sp_ret */ /* sp <- cont_ctx.sp_ret */
l32i a1, a2, 4 l32i a1, a2, 4

View File

@ -33,6 +33,8 @@ typedef struct cont_ {
unsigned* sp_yield; unsigned* sp_yield;
unsigned* stack_end; unsigned* stack_end;
unsigned unused1;
unsigned unused2;
unsigned stack_guard1; unsigned stack_guard1;
unsigned stack[CONT_STACKSIZE / 4]; unsigned stack[CONT_STACKSIZE / 4];

View File

@ -25,7 +25,7 @@
void cont_init(cont_t* cont) { void cont_init(cont_t* cont) {
cont->stack_guard1 = CONT_STACKGUARD; cont->stack_guard1 = CONT_STACKGUARD;
cont->stack_guard2 = CONT_STACKGUARD; cont->stack_guard2 = CONT_STACKGUARD;
cont->stack_end = cont->stack + (sizeof(cont->stack) / 4 - 1); cont->stack_end = cont->stack + (sizeof(cont->stack) / 4);
cont->struct_start = (unsigned*) cont; cont->struct_start = (unsigned*) cont;
} }

View File

@ -59,7 +59,7 @@ void preloop_update_frequency() {
extern void (*__init_array_start)(void); extern void (*__init_array_start)(void);
extern void (*__init_array_end)(void); extern void (*__init_array_end)(void);
static cont_t g_cont; cont_t g_cont __attribute__ ((aligned (16)));
static os_event_t g_loop_queue[LOOP_QUEUE_SIZE]; static os_event_t g_loop_queue[LOOP_QUEUE_SIZE];
static uint32_t g_micros_at_task_start; static uint32_t g_micros_at_task_start;