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

Possible error in PUSH immediate #6

Open
klkblake opened this issue Nov 6, 2017 · 1 comment
Open

Possible error in PUSH immediate #6

klkblake opened this issue Nov 6, 2017 · 1 comment
Labels

Comments

@klkblake
Copy link

klkblake commented Nov 6, 2017

The PUSH immediate encodings list the operands types as Ibss and Ivs, the descriptions for which state that they are sign-extended to the size of the stack pointer (which is fixed at 64 bits in 64 bit mode). However, the Intel manual states that immediate operands to PUSH are sign-extended to the operand size, which defaults to 64 bits in 64 bit mode but may be set to 16 bits using the operand size override prefix. Testing indicates that this does in fact work and it's sign extended to the operand size as the Intel manual states.

@BarebitOpenSource
Copy link
Contributor

Good point. I don't have the original Intel manual that's been around when I wrote the reference but I'd swear the operation was described as follows:

  1. the immediate value is sign-extended to the size of stack pointer (64 bits in 64-bit mode)
  2. the value is truncated according to operand size (64 or 16 bits in 64-bit mode)
  3. the result is pushed to stack

Now, the Ibss and Ivs cover only the first point, i.e. that the immediate is sign-extended. The rest belongs to operand size rules. Anyway, I will think about updating the description.

And sorry for late response.

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

No branches or pull requests

2 participants