Skip to content

Commit 66be67c

Browse files
committed
Fix alignment of continuations stack
1 parent 7a9563d commit 66be67c

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

cores/esp8266/cont.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ cont_resume:
106106

107107
cont_norm:
108108
/* calculate pointer to cont_ctx.struct_start from sp */
109-
l32i a2, a1, 8
109+
l32i a2, a1, 4
110110
/* sp <- cont_ctx.sp_ret */
111111
l32i a1, a2, 4
112112

cores/esp8266/cont.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ typedef struct cont_ {
3333
unsigned* sp_yield;
3434

3535
unsigned* stack_end;
36+
unsigned unused1;
37+
unsigned unused2;
3638
unsigned stack_guard1;
3739

3840
unsigned stack[CONT_STACKSIZE / 4];

cores/esp8266/cont_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
void cont_init(cont_t* cont) {
2626
cont->stack_guard1 = CONT_STACKGUARD;
2727
cont->stack_guard2 = CONT_STACKGUARD;
28-
cont->stack_end = cont->stack + (sizeof(cont->stack) / 4 - 1);
28+
cont->stack_end = cont->stack + (sizeof(cont->stack) / 4);
2929
cont->struct_start = (unsigned*) cont;
3030
}
3131

cores/esp8266/core_esp8266_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void preloop_update_frequency() {
5959
extern void (*__init_array_start)(void);
6060
extern void (*__init_array_end)(void);
6161

62-
static cont_t g_cont;
62+
cont_t g_cont __attribute__ ((aligned (16)));
6363
static os_event_t g_loop_queue[LOOP_QUEUE_SIZE];
6464

6565
static uint32_t g_micros_at_task_start;

0 commit comments

Comments
 (0)