Skip to content

Commit 068fa5a

Browse files
Fix repaintable stack calculation
Fixes #5794 as found by @mattbradford83
1 parent ca2f31a commit 068fa5a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cores/esp8266/cont_util.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ void cont_repaint_stack(cont_t *cont)
7373
register uint32_t *sp asm("a1");
7474
// Ensure 64 bytes adjacent to the current SP don't get touched to endure
7575
// we don't accidentally trounce over locals or IRQ temps.
76-
uint32_t sp_safe = CONT_STACKSIZE/4 - ((sp - &cont->stack[0] - 64)/4);
77-
7876
// Fill stack with magic values
79-
for(uint32_t pos = 0; pos < sp_safe; pos++)
77+
for ( uint32_t *pos = sp - 16; pos != &cont->stack[0]; pos-- )
8078
{
81-
cont->stack[pos] = CONT_STACKGUARD;
79+
*pos = CONT_STACKGUARD;
8280
}
8381
}
8482

0 commit comments

Comments
 (0)