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

Various X87 instructions incorrectly print explicit st0 where it should be implicit #189

Closed
athre0z opened this issue Aug 2, 2021 · 1 comment
Assignees
Labels
A-decoder Area: Decoder C-bug Category: This is a bug (or a fix for a bug, when applied to PRs) P-medium Priority: Medium
Milestone

Comments

@athre0z
Copy link
Member

athre0z commented Aug 2, 2021

It was brought to my attention by @fvrmatteo that Zydis currently incorrectly prints an explicit st0 for some instructions where it should be implicit / hidden according to Intel SDM. An example of such an instruction is DD 18 alias fstp:

SDM

Screen Shot 2021-08-03 at 01 46 49

Zydis

fstp qword ptr ds:[rax], st0

However, this also affects many other X87 instructions. While I originally thought that this would be an easy fix, I later realized that it will require us to reorder the operands for many of these instructions. This is the case because Zydis guarantees that the visible (explicit) operands are first in the operand list, and many users (as well as our own code) rely on that.

For this reason, we decided to postpone this fix until the next major version, Zydis 4.0, in order to comply with our semantic versioning stability guarantee.

XED has the same issue but seems to consider it wontfix: intelxed/xed#162

@athre0z athre0z added C-bug Category: This is a bug (or a fix for a bug, when applied to PRs) A-decoder Area: Decoder P-medium Priority: Medium labels Aug 2, 2021
@athre0z athre0z self-assigned this Aug 2, 2021
@athre0z athre0z added this to the v4.0.0 milestone Aug 3, 2021
@williballenthin
Copy link
Contributor

This is the case because Zydis guarantees that the visible (explicit) operands are first in the operand list...

Oh, neat, I didn't realize this. Thanks for mentioning here!

athre0z added a commit that referenced this issue Apr 26, 2022
As explained in #189, we previously had st0 as an explicit operand where it is
supposed to be suppressed. This PR fixes all such cases.

Corresponding zydis-db PR: zyantific/zydis-db#12

Resolves #189
athre0z added a commit that referenced this issue Apr 26, 2022
As explained in #189, we previously had st0 as an explicit operand where it is
supposed to be suppressed. This PR fixes all such cases.

Corresponding zydis-db PR: zyantific/zydis-db#12

Resolves #189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-decoder Area: Decoder C-bug Category: This is a bug (or a fix for a bug, when applied to PRs) P-medium Priority: Medium
Projects
None yet
Development

No branches or pull requests

2 participants