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

MOV need to be splitted to mem and nomem syntaxes #52

Closed
Kashio opened this issue Apr 25, 2023 · 2 comments
Closed

MOV need to be splitted to mem and nomem syntaxes #52

Kashio opened this issue Apr 25, 2023 · 2 comments

Comments

@Kashio
Copy link

Kashio commented Apr 25, 2023

Right now MOV encoded with opcode 8E use operand type w for its operand of addressing E which is defined as:

Word, regardless of operand-size attribute (for example, ENTER).

According to the intel docs:

        8E /r MOV Sreg,r/m16** RM Valid Valid Move r/m16 to segment register.
REX.W + 8E /r MOV Sreg,r/m64** RM Valid Valid Move lower 16 bits of r/m64 to segment register.

When dealing with memory addressing the operand always points to word pointer as expected, but when dealing with register addressing, one need to specify the full register name even tho the instruction only uses the lower 16 bit of the register, thus I think the appropriate solution would be to split the syntax to mem and nomem attributes, when the mem one has operand type w and the nomem one has operand type v because the operand size prefix can affect the register in use according to my testing on objdump which is defined as::

Word or doubleword, depending on operand-size attribute (for example, INC (40), PUSH (50)).

For 64 bit mode the operand type should be vqp which is defined as:

Word or doubleword, depending on operand-size attribute, or quadword, promoted by REX.W in 64-bit mode.

EDIT: clarity

Kashio added a commit to Kashio/x86reference that referenced this issue Apr 25, 2023
@BarebitOpenSource
Copy link
Contributor

Good catch. However, it seems like objdump doesn't follow the syntax defined in Intel manual. The operand is either 16-bit or 64-bit, never 32-bit one, according to the manual.

In 64-bit mode, the register is either 16-bit or 64-bit, depending on REX.W. It seems like we need a new type wqp: "Word, or quadword, promoted by REX.W in 64-bit mode".

And there's similar issue with 8C MOV Rvqp, Sw. It should be 8C MOV Rwqp, Sw.

@BarebitOpenSource
Copy link
Contributor

Moved to mazegen/x86reference#19

@BarebitOpenSource BarebitOpenSource closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
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

No branches or pull requests

2 participants