mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-08 17:02:26 +03:00
Add stack repainting call to ESP class (#5221)
Allow the unused stack to be reset to the check value at any time in the application, allowing for delta-stack calculations to be done. Add ESP.resetFreeContStack() class method for general use. Add in some dumping in the BearSSL_Validation example to show the usage for those that care.
This commit is contained in:
committed by
GitHub
parent
d17ffc2874
commit
1b1b0a28a8
@ -64,3 +64,18 @@ bool ICACHE_RAM_ATTR cont_can_yield(cont_t* cont) {
|
||||
return !ETS_INTR_WITHINISR() &&
|
||||
cont->pc_ret != 0 && cont->pc_yield == 0;
|
||||
}
|
||||
|
||||
// No need for this to be in IRAM, not expected to be IRQ called
|
||||
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++)
|
||||
{
|
||||
cont->stack[pos] = CONT_STACKGUARD;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user