Fix amd64 restore callback stack pointer#18
Merged
kristjanvalur merged 3 commits intomasterfrom May 9, 2026
Merged
Conversation
Restore the sysv_amd64 callback stack-pointer fix so STACKMAN_OP_RESTORE receives the active switched stack pointer, not the pre-switch value. Update both the assembly and inline GCC x86_64 paths for consistent callback behavior. Add a regression assertion in tests/test.c and document the fix in CHANGELOG.md under Unreleased.
Pin build-windows to windows-2022 to avoid v143 toolset availability drift on windows-latest, especially for ARM64. Document this CI change in CHANGELOG.md under Unreleased.
There was a problem hiding this comment.
Pull request overview
Fixes an amd64 (System V x86_64, GCC) stack-switching bug where the RESTORE callback was receiving an incorrect stack-pointer argument, aligning both the generated assembly and inline-asm implementations. Adds a regression assertion in the core C test suite and documents the fix in the changelog; also pins the Windows CI runner to windows-2022 for toolset stability.
Changes:
- Pass the active switched
%rsp(not the saved%rbx) as the RESTORE callback stack-pointer argument inswitch_x86_64_gcc.S. - Align the inline GCC x86_64 implementation to pass
stack_pointer2to the RESTORE callback. - Add a regression assertion in
tests/test.cand document the fix under[Unreleased]inCHANGELOG.md(plus pin Windows runner towindows-2022).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test.c |
Adds an assertion to ensure RESTORE receives the active switched stack pointer. |
stackman/platforms/switch_x86_64_gcc.S |
Fixes RESTORE callback argument to pass %rsp (active switched SP). |
stackman/platforms/switch_x86_64_gcc.h |
Fixes inline-asm RESTORE callback argument to pass the switched stack pointer. |
CHANGELOG.md |
Documents the amd64 restore-argument fix and the added regression assertion under [Unreleased]. |
.github/workflows/buildcommit.yml |
Pins Windows CI runner to windows-2022. |
Comment on lines
+8
to
+12
| ## [Unreleased] | ||
|
|
||
| ### Changed | ||
| - CI: pinned Windows runner to `windows-2022` (from `windows-latest`) to keep VS2022 v143 toolset availability stable for ARM64 builds | ||
|
|
| - CI: pinned Windows runner to `windows-2022` (from `windows-latest`) to keep VS2022 v143 toolset availability stable for ARM64 builds | ||
|
|
||
| ### Fixed | ||
| - Fixed amd64 (sysv_x86_64 GCC) restore callback stack-pointer argument to pass the active switched stack pointer |
Use sysv_amd64 naming in Unreleased fix entry and add missing [Unreleased] compare link reference.
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.
Summary
Validation