mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
cf5ef7f0e1
Commit 891eb3b0 was fixing an issue with PS and EPC1 not being preserved after the window spill procedure. It did so by saving PS in a2 and EPC1 in a4. However the a4 register may be a live register of another window in the call stack, and if it is overwritten and then spilled to the stack, then the corresponding register value will end up being corrupted. In practice the problem would show up as an IllegalInstruction exception, when trying to return from a function when a0 value was 0x40020. Fix by using a0 register instead of a4 as scratch. Also fix a comment about xthal_save_extra_nw, as this function in fact doesn't clobber a4 or a5 because XCHAL_NCP_NUM_ATMPS is defined as 1. Closes https://github.com/espressif/esp-idf/issues/5758