spin: stash stack pointer on the parent road, restore from it#966
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #965
Currently, when new road is entered, the state of the spin stack is saved on that road, and it is restored in
u3m_bailbefore longjump. However, u3m_bail is not the only way to leave a road with non-local control flow, we can also jump back all the way to the home road on a signal, e.g. SIGINT.This caused the spin stack offset to be set to zero (because apparently it was the initial value in the home road), which broke logic in
_http_spin_timer_cb, which assumes that there is always an offset of at least 4 (likely comes fromc3__rootinitialization).This PR fixes the road entry/exit logic by stashing the stack info on the road that we are about to leave, and restoring it on road promotion. That way the home road values are set on leap from the home road, so
_cm_signal_recovercorrectly restores the state of the spin stack on ^C.