Skip to content

spin: stash stack pointer on the parent road, restore from it#966

Merged
pkova merged 1 commit into
developfrom
dozreg/spin-parent
Feb 19, 2026
Merged

spin: stash stack pointer on the parent road, restore from it#966
pkova merged 1 commit into
developfrom
dozreg/spin-parent

Conversation

@dozreg-toplud

@dozreg-toplud dozreg-toplud commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

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_bail before 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 from c3__root initialization).

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_recover correctly restores the state of the spin stack on ^C.

@dozreg-toplud dozreg-toplud requested a review from a team as a code owner February 19, 2026 11:06
@pkova pkova merged commit 787c0da into develop Feb 19, 2026
2 checks passed
@pkova pkova deleted the dozreg/spin-parent branch February 19, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spin stack seemingly stops working after ^C

2 participants