Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macaw-x86: Fix call semantics when call target involves the stack pointer #421

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

RyanGlScott
Copy link
Contributor

Previously, the macaw-x86 semantics for call would retrieve the call target after pushing the next instruction's address to the stack, but if the call target involves the stack pointer, then this would mean that it would get the next instruction's address when retrieving the call target. This is not what is intended!

This patch fixes the issue by always retrieving the call target before pushing the next instruction's address to the stack. I have added a test case to the macaw-x86-symbolic test suite which demonstrates that this fix works as intended.

Fixes #420.

…ointer

Previously, the `macaw-x86` semantics for `call` would retrieve the call target
*after* pushing the next instruction's address to the stack, but if the call
target involves the stack pointer, then this would mean that it would get the
next instruction's address when retrieving the call target. This is not what is
intended!

This patch fixes the issue by always retrieving the call target *before*
pushing the next instruction's address to the stack. I have added a test case
to the `macaw-x86-symbolic` test suite which demonstrates that this fix works
as intended.

Fixes #420.
@RyanGlScott RyanGlScott added the arch:x86 x86 issues label Aug 13, 2024
@RyanGlScott RyanGlScott merged commit 1add473 into master Aug 13, 2024
3 checks passed
@RyanGlScott RyanGlScott deleted the T420-macaw-x86-call-semantics-fix branch August 13, 2024 16:31
@Ptival
Copy link
Contributor

Ptival commented Aug 13, 2024

Nice catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch:x86 x86 issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macaw-x86: call semantics are wrong when the call target involves the stack pointer
3 participants