Skip to content

Fix repaintable stack calculation #5821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cores/esp8266/cont_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ void cont_repaint_stack(cont_t *cont)
register uint32_t *sp asm("a1");
// Ensure 64 bytes adjacent to the current SP don't get touched to endure
// we don't accidentally trounce over locals or IRQ temps.
uint32_t sp_safe = CONT_STACKSIZE/4 - ((sp - &cont->stack[0] - 64)/4);

// Fill stack with magic values
for(uint32_t pos = 0; pos < sp_safe; pos++)
for ( uint32_t *pos = sp - 16; pos >= &cont->stack[0]; pos-- )
{
cont->stack[pos] = CONT_STACKGUARD;
*pos = CONT_STACKGUARD;
}
}

Expand Down