Skip to content

Fix amd64 restore callback stack pointer#18

Merged
kristjanvalur merged 3 commits intomasterfrom
fix/amd64-callback-sp
May 9, 2026
Merged

Fix amd64 restore callback stack pointer#18
kristjanvalur merged 3 commits intomasterfrom
fix/amd64-callback-sp

Conversation

@kristjanvalur
Copy link
Copy Markdown
Collaborator

Summary

  • restore sysv_amd64 restore-callback stack pointer fix
  • align both assembly and inline GCC x86_64 paths
  • add regression assert in tests/test.c for RESTORE stack pointer
  • document fix under Unreleased in CHANGELOG

Validation

  • make clean
  • make test
  • all test suites passed on sysv_amd64

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in switch_x86_64_gcc.S.
  • Align the inline GCC x86_64 implementation to pass stack_pointer2 to the RESTORE callback.
  • Add a regression assertion in tests/test.c and document the fix under [Unreleased] in CHANGELOG.md (plus pin Windows runner to windows-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 thread CHANGELOG.md
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

Comment thread CHANGELOG.md Outdated
- 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.
@kristjanvalur kristjanvalur merged commit 060e4f6 into master May 9, 2026
10 checks passed
@kristjanvalur kristjanvalur deleted the fix/amd64-callback-sp branch May 9, 2026 11:28
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.

2 participants